Declaring and Initializing Java Variables Instructions Declare an integer variable named newAge. Declare and initialize an integer variable named currentAge. Initialize this variable with your current...


Declaring and Initializing Java Variables
Instructions



  1. Declare an integer variable named 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 current year. Use four digits for the year.

  4. Execute the program.


Done<br>><br>AA<br>A delmarlearning.com<br>B Declaring and<br>NewAge.java<br>>- Terminal<br>Initializing Java<br>1// This program calculates your age in the year<br>2050.<br>NewAge.java:9: error: ;'e<br>Variables<br>2 // Input: None.<br>xpected<br>currentAge=18<br>3// Output: Your current age followed by your age<br>1 error<br>Error: Could not find or lo<br>ad main class NewAge<br>O<br>in 2050.<br></><br>Summary<br>4<br>In this lab, you declare and<br>5 public class NewAge<br>6 {<br>initialize variables in a Java<br>public static void main(String args[])<br>8.<br>program. The program file named<br>. NewAge.java, calculates your age<br>9.<br>currentAge=18<br>10<br>in the year 2050.<br>11<br>12<br>newAge = currentAge + (2050 - 2021);<br>%3D<br>Instructions<br>13<br>14<br>System.out.println(

Extracted text: Done > AA A delmarlearning.com B Declaring and NewAge.java >- Terminal Initializing Java 1// This program calculates your age in the year 2050. NewAge.java:9: error: ;'e Variables 2 // Input: None. xpected currentAge=18 3// Output: Your current age followed by your age 1 error Error: Could not find or lo ad main class NewAge O in 2050. Summary 4 In this lab, you declare and 5 public class NewAge 6 { initialize variables in a Java public static void main(String args[]) 8. program. The program file named . NewAge.java, calculates your age 9. currentAge=18 10 in the year 2050. 11 12 newAge = currentAge + (2050 - 2021); %3D Instructions 13 14 System.out.println("My Current Age is 18" + currentAge); 1. Declare an integer variable %3D 15 System.out.println("I will be + newAge + named newAge. in 2050."); 16 2. Declare and initialize an 17 System.exit(0); integer variable named 18 currentAge. Initialize this 19 } 20 variable with your current age. 3. Declare and initialize an integer variable named currentYear , Initialize this variable with the value of the current year. Use four digits !!
Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here