View Single Post
Join Date: Apr 2007
Posts: 40
Reputation: rapperhuj is an unknown quantity at this point 
Solved Threads: 0
rapperhuj rapperhuj is offline Offline
Light Poster

Else If statement

 
0
  #1
Sep 6th, 2007
Hello everyone, I just need help on this code. I can't debug it, I'm just new in Java and this is just my fifth assignment so I'm really having a hard time.

Here's my code:

  1. import java.io.*;
  2. public class input
  3. {
  4. public static InputStreamReader Reader=new
  5. InputStreamReader (System.in);
  6. public static BufferedReader input=new
  7. BufferedReader(Reader);
  8. public static void main(String args[]);
  9. String name;
  10. int age;
  11. double salary;
  12. {
  13. System.out.println("Enter name:");
  14. name=input.readline();
  15. System.out.println("Enter age:");
  16. age=Integer.parseInt(input.readLine());
  17. if(age<=18)
  18. System.out.println("Too young!");
  19. }
  20. else if (age>=18);
  21. {
  22. System.out.println("You're ready to vote!");
  23. }
  24. }

the Error says that:
illegal start of type line 20
<identifier> expected line 20

  1. else if (age>=18);
Can anyone please tell me how to debug it? =/
Reply With Quote