dulindraxe dulindraxe - 3 months ago 36
Java Question

Get computer time

I would like to know how I can tell to this simple program to replace the

string with a
"computer time - yearOfBirth"

I don't know how to set the computer time as an int and how to proceed...

public static void main(String[] args) {
Scanner in;
int yearOfBirth, years;
in = new Scanner (System.in);
System.out.print ("Year of Birth: ");
yearOfBirth = in.nextInt();
years = 2016 - yearOfBirth;
System.out.println("You are almost "+years+" years old");

years = Calendar.getInstance().get(Calendar.YEAR) - yearOfBirth;