Results 1 to 5 of 5
  1. #1
    dcarter's Avatar
    dcarter is offline Student
    Join Date
    Sep 2014
    Location
    NC
    Posts
    14
    Rep Power
    0

    Default I don't know what this compiler error message means?

    This is my code:

    Java Code:
    import java.util.*;
    
    public class Driver
    {
        double radius, length, width, base, base2, height;
        int menuChoice;
        Scanner input = new Scanner(System.in);
        
        System.out.println("Menu options: ");
        System.out.println("1 - Circle");
        System.out.println("2 - Rectangle");
        System.out.println("3 - Triangle");
        System.out.println("4 - Trapezoid");
        System.out.println("Enter -1 to quit.");
    Well, not all of it. But I believe it has all that is relevant to my question.

    When I go to compile (and I use BlueJ), I get a little highlighter right after println and before the parenthesis on line 9 and it says "<identifier> expected".
    What does that mean?

  2. #2
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    6,226
    Rep Power
    13

    Default Re: I don't know what this compiler error message means?

    Your print statements are not placed properly in the class. They need to be in a method.

    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

  3. #3
    dcarter's Avatar
    dcarter is offline Student
    Join Date
    Sep 2014
    Location
    NC
    Posts
    14
    Rep Power
    0

    Default Re: I don't know what this compiler error message means?

    How the hell did I forget main!? Thanks!

  4. #4
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,422
    Blog Entries
    7
    Rep Power
    28

    Default Re: I don't know what this compiler error message means?

    Quote Originally Posted by dcarter View Post
    How the hell did I forget main!? Thanks!
    It's not especially the main method: ordinary statements belong in a method body; any method. The only thing special to the main method is that the JVM tries to find it to get the entire hoopla starting.

    kind regards,

    Jos
    Build a wall around Donald Trump; I'll pay for it.

  5. #5
    dcarter's Avatar
    dcarter is offline Student
    Join Date
    Sep 2014
    Location
    NC
    Posts
    14
    Rep Power
    0

    Default Re: I don't know what this compiler error message means?

    Quote Originally Posted by JosAH View Post
    It's not especially the main method: ordinary statements belong in a method body; any method. The only thing special to the main method is that the JVM tries to find it to get the entire hoopla starting.

    kind regards,

    Jos
    I know, but what I needed there was the main method. It's where my program is starting.

Similar Threads

  1. What the error means?
    By MaXER in forum New To Java
    Replies: 12
    Last Post: 09-17-2012, 03:09 PM
  2. Replies: 1
    Last Post: 04-17-2012, 02:03 AM
  3. Replies: 3
    Last Post: 01-23-2009, 09:53 AM
  4. what does this error means?
    By tiiim83 in forum New To Java
    Replies: 2
    Last Post: 01-06-2009, 04:17 PM
  5. Does anyone know what these error means?
    By minifish in forum New To Java
    Replies: 2
    Last Post: 11-04-2008, 05:37 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
  •