I'm new to Java. I'm learning by myself without guide. Can anyone help me with this little piece of code? What am I doing wrong??
package Lessons; import java.util.Scanner; public class lesson1 { public static void main (String []Args) { Scanner input = new Scanner (System.in); int age; System.out.println("How old are you?"); age = input.nextInt(); if (age >= 20); System.out.print("You Passed!"); else ( age <= 20) System.out.println("You Failed!"); } } The issue is in else. I'm working on Eclipse and I don't get any help solution from it on what to do.
if (age >= 20);- remove;and also remove( age <= 20){and}to delimit the statements that you want to run after anifand after the matchingelse. Otherwise, madness ensues.