Hello.
I am new to java. I thought you only put one static statement in the code, "public static void main(String[] args)"
But this code has more than one static statement.
What is the difference between the first 2 static statements & the ""public static void main(String[] args)" statement? Why have both? Why not put the 1st two static statements under the public static... statement? Is this example trying to show me different ways of using static? Thanks In Advance.
Code:import java.util.*;
public class Ex2_26 //Pg. 75
{ // Beginning of class
static final int NUMBER = 12;
static Scanner console = new Scanner(System.in);
public static void main(String[] args)
{
int firstNum;
int secondNum;
firstNum = 18;
System.out.println("Line 11: firstNum = "
+ firstNum); // output the value of firstNum
System.out.print("Line 12: Enter an integer: ");
secondNum = console.nextInt(); // read & store the integer into the variable secondNum
System.out.println();
System.out.println("Line 15: secondNum = "
+ secondNum);
firstNum = firstNum + NUMBER + 2 * secondNum;
System.out.println("Line 17: The new value of " +
"firstNum = " + firstNum);
}
}

