Results 1 to 4 of 4
  1. #1
    RachLee is offline Member
    Join Date
    Oct 2014
    Posts
    6
    Rep Power
    0

    Default <identifier> expected error?

    I really do not see the error in the code, I am not even finished because I did not want to move forward without working out these errors. I put the error next to the line. Can anyone help?

    import java.util.*;
    public class CircleLoop {
    public static void main (String[] args) {
    }

    public static final double PI= 3.14159265;
    double radius;
    double area;
    double diameter;
    double circumference;
    Scanner console = new Scanner(System.in);

    System.out.println("Enter radius"); <identifier> expected & illegal start of type
    radius = console.nextDouble; <identifier> expected
    }

  2. #2
    RamyaSivakanth's Avatar
    RamyaSivakanth is offline Senior Member
    Join Date
    Apr 2009
    Location
    Chennai
    Posts
    878
    Rep Power
    11

    Default Re: <identifier> expected error?

    please gothru the syntax before trying ..lots of issues..

    1. you have closed the main and written the code in class which is totally wrong..all the above code should be in method or block.
    2.nextDouble() u should use as it is a method.


    3.final should be declared in class level.

    correct the mistakes mentioned
    Ramya:cool:

  3. #3
    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: <identifier> expected error?

    Those two lines are ordinary statements and they're not in the body of a method. That is illegal in the Java language. Put those statements in a method, e.g. in main( ... )

    kind regards,

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

  4. #4
    RachLee is offline Member
    Join Date
    Oct 2014
    Posts
    6
    Rep Power
    0

    Default Re: <identifier> expected error?

    Ohhh, I see now. Thank you so much I did not even realize, frustration just kicked in that it wouldn't compile. Thanks!

Similar Threads

  1. <identifier expected> error
    By jacjacjac in forum New To Java
    Replies: 5
    Last Post: 10-14-2012, 03:39 AM
  2. Error: Identifier Expected
    By vickyv200 in forum New To Java
    Replies: 9
    Last Post: 08-31-2012, 11:05 AM
  3. <identifier expected> error. please help!
    By christopherx in forum AWT / Swing
    Replies: 9
    Last Post: 10-02-2011, 11:23 PM
  4. Error:identifier expected(Help!)
    By chhoton in forum New To Java
    Replies: 8
    Last Post: 09-22-2009, 05:42 PM
  5. Identifier expected error
    By vasu18 in forum New To Java
    Replies: 1
    Last Post: 01-01-2008, 06:49 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
  •