Java I – Variable Practice Worksheet:
Example Code:
3.2. The Final Program
VariablePractice
/* Program Name: DoeJoVariablePractice
* Author : John Doe
* Date Written : 01/01/15
* Class : CIT 149 Java I
* Description: Put a good description here
* of what this program does.
*/
public class ExampleVariablePractice
{
public static void main(String [ ]args)
{
inttheFirstNumber = 16; // Initializedvariables
int theSecondNumber =7;
int sum =0;
int difference =0;
System.out.println(“**** Addition ****”);
// Do thecalculation and store the result in the variable sum
sum =theFirstNumber + theSecondNumber;
//System.out.println(sum); // 1
System.out.println(theFirstNumber + “+” + theSecondNumber + “=” +sum);
//System.out.println(theFirstNumber + theSecondNumber); // 2
System.out.println(“**** Subtraction ****”);
// Subtract thetwo numbers and store the answer in
PayPal Gateway not configured
PayPal Gateway not configured