Results 1 to 5 of 5
Like Tree2Likes
  • 1 Post By jim829
  • 1 Post By JosAH

Thread: error in java prog "end of file while parsing

  1. #1
    simar is offline Member
    Join Date
    Aug 2014
    Posts
    27
    Rep Power
    0

    Default error in java prog "end of file while parsing

    can anyne help me out here is code and error file i shal b vry thnkful
    Attached Thumbnails Attached Thumbnails error in java prog "end of file while parsing-p1.png   error in java prog "end of file while parsing-e1.png  
    Last edited by simar; 08-09-2014 at 05:56 PM.

  2. #2
    jim829 is online now Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    4,036
    Rep Power
    6

    Default Re: error in java prog "end of file while parsing

    There is a period in your getData method. Should be a comma. Also,
    instead of saving an image of your code why not just paste it in the
    message. Put it between code tags [code][/code] to preserve formatting.

    Regards,
    Jim
    Last edited by jim829; 08-09-2014 at 06:01 PM.
    simar likes this.
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

  3. #3
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,785
    Blog Entries
    7
    Rep Power
    21

    Default Re: error in java prog "end of file while parsing

    Quote Originally Posted by jim829 View Post
    There is a period in your getData method. Should be a comma.
    ,

    Sharp eyes; what surprises me a bit is that the compiler finds the error so late in the source text; after having parsed the '(' it should know that it is parsing the method signature and a dot at that position simply doesn't make sense ...

    kind regards,

    Jos
    simar likes this.
    cenosillicaphobia: the fear for an empty beer glass

  4. #4
    simar is offline Member
    Join Date
    Aug 2014
    Posts
    27
    Rep Power
    0

    Default Re: error in java prog "end of file while parsing

    here is also the same error as i ask u the above that reached end of file while parsing
    thxxx
    Java Code:
    class disp {  public static void main(String args[])   {     System.out.println("screen display");     for(int i = 1; i<=9; i  )     {       for(int j = 1; j <= i; j  )       {        System.out.print(" ");        System.out.print(i);       }       System.out.print("\n");     }     System.out.println("we done it"); }

  5. #5
    jim829 is online now Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    4,036
    Rep Power
    6

    Default Re: error in java prog "end of file while parsing

    Well, I just decided to re-create the OP's program and compile it in both Eclipse and
    JDK 8.0. Both Eclipse and javac point out the error and many more. Even when the
    error is fixed, the compiler complains that there is no (int,int) constructor in rom
    (can't convert int to float). I no longer have my Java 7 JDK installed so I can't tell
    if Oracle improved the compiler or if the OP isn't giving us the complete story.

    @OP are those all the error messages? Because javac for JDK 8 pointed out specifically
    that you needed a comma and not a period.

    Here's the code if you want to try it.

    Java Code:
    class Rom {
       public float l,b;
       void getData(float a. float c) {
          l = a;
          b = c;
       }
    }
    public class SyntaxProb {
       public static void main(String[] args) {
          float area;
          Rom rom = new Rom(14,10);
          area = rom.b * rom.l;
          System.out.println("Area = " + area);
       } 
    }
    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

Similar Threads

  1. Replies: 3
    Last Post: 04-10-2014, 10:17 AM
  2. Replies: 2
    Last Post: 01-16-2014, 07:16 PM
  3. Replies: 1
    Last Post: 09-28-2011, 10:33 AM
  4. FTP parsing remote file error
    By agangaia in forum New To Java
    Replies: 0
    Last Post: 04-18-2011, 09:45 PM
  5. Replies: 6
    Last Post: 02-10-2011, 10:55 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
  •