How to declare an integer variable name newage


Discuss the below program data in java:

Declaring and initializing Java Variables

Calculate your age in the year 2060.

1. Declare an integer variable name newAge.

2. Declare and initialize an integer variable named currentAge. Initialize this variable with your current age.

3. Declare and initialize an integer variable named currentYear. Initialize this variable with the value of the currentYear. Use four digits for year. Use four digits for the year.

4. Compile the source code file Newage.java.

5. Execute the program. Record the output of this program.

Solution Preview :

Prepared by a verified Expert
JAVA Programming: How to declare an integer variable name newage
Reference No:- TGS01934361

Now Priced at $20 (50% Discount)

Recommended (99%)

Rated (4.3/5)