Results 1 to 4 of 4

Thread: Newbie problem

  1. #1
    hyookai is offline Member
    Join Date
    Mar 2011
    Posts
    2
    Rep Power
    0

    Question Newbie problem

    Hey, I started a while ago some Java tutorials and I encountered a problem with a small application from the tutorial. When I try to run it I get this error:

    -Cannot find the main class: arrayDemo. Program will exit.

    Here is the code of the application arrayDemo:

    Java Code:
    class ArrayDemo {
         public static void main(String[] args) {
              int[] anArray;              
    
              anArray = new int[10];      
                
              anArray[0] = 100; 
              anArray[1] = 200; 
              anArray[2] = 300; 
              anArray[3] = 400;
              anArray[4] = 500;
              anArray[5] = 600;
              anArray[6] = 700;
              anArray[7] = 800;
              anArray[8] = 900;
              anArray[9] = 1000;
    
              System.out.println("Element at index 0: " + anArray[0]);
              System.out.println("Element at index 1: " + anArray[1]);
              System.out.println("Element at index 2: " + anArray[2]);
              System.out.println("Element at index 3: " + anArray[3]);
              System.out.println("Element at index 4: " + anArray[4]);
              System.out.println("Element at index 5: " + anArray[5]);
              System.out.println("Element at index 6: " + anArray[6]);
              System.out.println("Element at index 7: " + anArray[7]);
              System.out.println("Element at index 8: " + anArray[8]);
              System.out.println("Element at index 9: " + anArray[9]);
         }
    }

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    12,999
    Blog Entries
    7
    Rep Power
    19

    Default

    Quote Originally Posted by hyookai View Post
    Hey, I started a while ago some Java tutorials and I encountered a problem with a small application from the tutorial. When I try to run it I get this error:

    -Cannot find the main class: arrayDemo. Program will exit.

    Here is the code of the application arrayDemo:

    Java Code:
    class ArrayDemo { ... }
    The name of the class is 'ArrayDemo', not 'arrayDemo'. Java is quite picky when it comes to capitalization of characters.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    Petr's Avatar
    Petr is offline Senior Member
    Join Date
    Jan 2011
    Location
    Russia
    Posts
    618
    Rep Power
    4

    Default

    How Are you run this code? I guess You have mistake in name file and name class.
    Skype: petrarsentev
    http://TrackStudio.com

  4. #4
    hyookai is offline Member
    Join Date
    Mar 2011
    Posts
    2
    Rep Power
    0

    Default

    Ah, yeah I have been trying with lowercase letter. Thanks for the info I didn't know they had to be exactly the same. :)

Similar Threads

  1. newbie here!
    By agua in forum Introductions
    Replies: 2
    Last Post: 01-19-2011, 05:29 AM
  2. [newbie] bracketing problem
    By jon80 in forum New To Java
    Replies: 15
    Last Post: 05-30-2009, 03:28 AM
  3. Newbie Help
    By mattkid in forum New To Java
    Replies: 4
    Last Post: 03-25-2009, 04:55 AM
  4. newbie newbie newbie
    By krislogy in forum New To Java
    Replies: 9
    Last Post: 08-15-2008, 12:28 AM
  5. Simple newbie problem: import 3rd party jar
    By jodyflorian in forum Eclipse
    Replies: 5
    Last Post: 05-30-2008, 04:02 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •