Post: what is wrong with this java code?
12-21-2017, 12:38 AM #1
(adsbygoogle = window.adsbygoogle || []).push({});
    import java.util.Scanner;
public class Program
{
public static void main(String[] args) {
int age;
Scanner input = new Scanner(System.in);
age = input.nextInt();
if(age>16){
System.out.println("get a job");
if(age>1Cool Man (aka Tustin){
System.out.println("you are old enough to smoke weed now");
}
}
}
else
{
System.out.println("sorry mate u are to young 4 either one");
}
}
12-21-2017, 02:43 AM #2
i figured it out...heres the correct code

    import java.util.Scanner;
public class Program
{
public static void main(String[] args) {
int age;
Scanner input = new Scanner(System.in);
age = input.nextInt();
if(age>16){
System.out.println("get a job");
if(age>1Cool Man (aka Tustin){
System.out.println("you are old enough to smoke weed now");
}
}

else
{
System.out.println("sorry mate u are to young 4 either one");
}
}
}

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo