Simple coding problem


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: Simple coding problem

Hybrid View

  1. #1
    Join Date
    May 2005
    Posts
    115

    Simple coding problem

    Code:
    public class TextGraph{
    	private char[][] screen;
    	private int scrW;
    	private int scrH;
    
    	public TextGraph(){}
    
    	public TextGraph(int x, int y){
    		scrW=x;
    		scrH=y;
    		screen= char[scrW][scrH];
    		
    	}
    }
    What is wrong with this line of code? I can't compile..it says something wrong at
    Code:
    		screen= char[scrW][scrH];

  2. #2
    Join Date
    Oct 2004
    Posts
    311
    what's the exact exception you get?
    and how do you call the TectGrap(x,y) constructor?

  3. #3
    Join Date
    Nov 2004
    Location
    Norway
    Posts
    1,560
    Try this:

    Code:
    screen= new char[scrW][scrH];
    eschew obfuscation

  4. #4
    Join Date
    May 2005
    Posts
    115
    Ah, i forgot arrays are objects..have to use 'new' keyword..

Similar Threads

  1. Replies: 0
    Last Post: 07-06-2005, 12:07 AM
  2. Simple SQL Parameter problem
    By Eric in forum Database
    Replies: 1
    Last Post: 11-10-2000, 03:05 AM
  3. typical problem, pls help
    By SATISH in forum Java
    Replies: 1
    Last Post: 09-29-2000, 10:33 AM
  4. Replies: 0
    Last Post: 06-23-2000, 03:17 PM
  5. Simple report problem
    By Gary Thompson in forum authorevents.kurata
    Replies: 1
    Last Post: 04-20-2000, 09:13 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center