Search Results

Search found 1 results on 1 pages for 'user2464795'.

Page 1/1 | 1 

  • If statements Evaluations

    - by user2464795
    Using the code below I get this result even though I put in a number that is greater than 18. run: How old are you? 21 You have not reached the age of Majority yet! BUILD SUCCESSFUL (total time: 3 seconds) I am new to java and trying to self learn can anybody help? import java.util.Scanner; public class Chapter8 { /** * @param args the command line arguments */ public static void main(String[] args) { Scanner reader = new Scanner (System.in); // TODO code application logic here //Excercise 15 System.out.print("How old are you? "); int x = Integer.parseInt(reader.nextLine()); if (x > 18){ System.out.println("You have not reached the age of Majority yet!"); }else { System.out.println("You have reached the age of Majority!"); }

    Read the article

1