DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 4 of 4
  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-05-2005, 11:07 PM
  2. Simple SQL Parameter problem
    By Eric in forum Database
    Replies: 1
    Last Post: 11-10-2000, 02:05 AM
  3. typical problem, pls help
    By SATISH in forum Java
    Replies: 1
    Last Post: 09-29-2000, 09:33 AM
  4. Replies: 0
    Last Post: 06-23-2000, 02:17 PM
  5. Simple report problem
    By Gary Thompson in forum authorevents.kurata
    Replies: 1
    Last Post: 04-20-2000, 08:13 PM

Bookmarks

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


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links