Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

import java.util.

Scanner;
public class Figuring_it_out {
public static void main(String[]args){
int age; // This makes the variable age
Scanner user_input = new Scanner(System.in); // This is making it so that the
computer can read inputs
// basically the thing is "user_input" and it is the keystrokes you make that
java records

inputted

System.out.println("How old are you?"); // asking them to type


age = user_input.nextInt(); // sets age to the next integer (nextInt()) that is

System.out.println("Your age is: " + age + " if you are not lying.");// prints
// the pluses let you add strings and ints to the same line
int plus_six = age + 6; // adds 6 to the number that is age
System.out.println("Your age is: " + plus_six + " six years from now, if you are
not lying."); // prints
}
}

How old are you?


17
Your age is: 17 if you are not lying.
Your age is: 23 six years from now, if you are not lying.

You might also like