Results 1 to 6 of 6
  1. #1
    gagnant is offline Member
    Join Date
    May 2013
    Posts
    3
    Rep Power
    0

    Default not a statement error

    import java.io.*;
    class Ma
    {
    public static void main(String[] args)
    {
    int num=90;
    float gradept;
    char grade;
    Maw m=new Maw();
    m.Fd();
    }}
    class Ma()
    {
    public void Fd()
    {
    if(num>0)
    { if(num>=80)
    {grade='a';
    gradept=5;
    }
    else if(num>=73 && num<=79)
    {grade='b';
    gradept=4.5;
    }
    else if(num>=60 && num<=72)
    {grade='c';
    gradept=4;
    }
    else(num<60)
    {grade='d';
    gradept=3;
    }}
    else
    {
    System.out.println("error");
    }
    System.out.println("grade is" + grade);
    System.out.println("gradept" + gradept);
    }}

    can sum1 help me,depending upon the value of num,it has print the grade n gradpt.bt i get error in line29 as "not a statement".
    Last edited by gagnant; 05-26-2013 at 07:23 PM.

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

    Default Re: not a statement error

    Quote Originally Posted by gagnant View Post
    can sum1 help me,depending upon the value of num,it has print the grade n gradpt.bt i get error in line29 as "not a statement".
    Which line is line #29?

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

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

    Default Re: not a statement error

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  4. #4
    gagnant is offline Member
    Join Date
    May 2013
    Posts
    3
    Rep Power
    0

    Default Re: not a statement error

    Srry, line 29 is Else (num <60)

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

    Default Re: not a statement error

    Quote Originally Posted by gagnant View Post
    Srry, line 29 is Else (num <60)
    'else' doesn't take a condition; if is either 'else ...' or 'else if (num < 60) ...'.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  6. #6
    gagnant is offline Member
    Join Date
    May 2013
    Posts
    3
    Rep Power
    0

Similar Threads

  1. Syntax error in If statement
    By robinsonth@gmail.com in forum New To Java
    Replies: 2
    Last Post: 11-08-2012, 10:38 AM
  2. Replies: 2
    Last Post: 03-26-2012, 04:27 PM
  3. SQL Statement Error
    By Dcalladi in forum New To Java
    Replies: 3
    Last Post: 01-30-2012, 04:38 PM
  4. Error: if statement
    By nandhinianand in forum NetBeans
    Replies: 2
    Last Post: 08-07-2011, 05:32 PM
  5. error in if statement
    By carman12 in forum New To Java
    Replies: 11
    Last Post: 12-25-2010, 01:13 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
  •