6.3k views
1 vote
In this lab, you declare and initialize constants in a Java program. The program file named NewAge2.java, calculates your age in the year 2050.

User Loler
by
8.7k points

2 Answers

3 votes
public class NewAge2 {
public static void main(String[] args) {
final int CURRENT_YEAR = 2023;
final int BIRTH_YEAR = 1990;
final int FUTURE_YEAR = 2050;

int currentAge = CURRENT_YEAR - BIRTH_YEAR;
int futureAge = currentAge + (FUTURE_YEAR - CURRENT_YEAR);

System.out.println("Your current age is: " + currentAge);
System.out.println("Your age in " + FUTURE_YEAR + " will be: " + futureAge);
}
}
User Nzjoel
by
7.3k points
2 votes

This sentence is a statement about a lab activity involving writing a Java program to calculate someone's age in the year 2050. The program is named NewAge2.java, and it involves declaring and initializing constants. The sentence does not provide any further details about the lab or how the program works, but it suggests that the program involves some mathematical calculations to determine someone's age in the future.

User Shmandor
by
7.8k points