Results 1 to 3 of 3

Thread: Coding issue

  1. #1
    mbw290 is offline Member
    Join Date
    Sep 2011
    Posts
    12
    Rep Power
    0

    Default Coding issue

    My professor gave us this program as an example to compile in class. I can't get it to compile. I get the following error in Dr. Java 2 errors found:
    File: /home/matt/Checkerboard.java [line: 3]
    Error: Syntax error on token "8", delete this token
    File: /home/matt/Checkerboard.java [line: 3]
    Error: Syntax error on token "8", delete this token

    Java Code:
    public class Checkerboard{
    public static void main(String[] args){
    char a [8][8];
    for (i=0;i<8;i++);
    {
      for (j=0;j<8;j++)
        System.out.print(a[i][j]);
        System.out.println("");
    }
    }
    }

  2. #2
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    You don't declare arrays like that in java, that is c++ type style. Try looking up how to use a constructor and the new keyword to declare and initialize an array properly.

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,458
    Rep Power
    20

Similar Threads

  1. Need help please with coding
    By avaiblas in forum NetBeans
    Replies: 2
    Last Post: 12-24-2010, 02:19 AM
  2. Replies: 4
    Last Post: 10-25-2010, 04:49 PM
  3. Need help coding
    By ace_03 in forum New To Java
    Replies: 2
    Last Post: 11-25-2009, 06:16 PM
  4. Better coding
    By tomiu in forum New To Java
    Replies: 1
    Last Post: 04-09-2009, 08:19 PM
  5. coding help
    By accies76 in forum New To Java
    Replies: 5
    Last Post: 11-12-2008, 09:15 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
  •