No. The incorrect splittings are highlighted in red:
cla ss example { public static void main ( String[] args ) { long hoursWorked = 40; double payRate = 10.0, taxRate = 0.10; System.out.println("Hours Worked: " + hoursWorked ); System.out.println("pay Amount : " + (hours Worked * payRate) ); System.out.println("tax Amount : " + ( hoursWorked * payRate * taxRate) ); }
The last statement is correct, although not done in a good style for easy human comprehension. The extra blank lines are OK.
So far, we have been using the value initially put into a variable, but not changing the value that a variable holds. Of course, variables are expected to vary by having new values placed into them as the program runs. An assignment statement changes the value that is held in a variable. Here is a program that uses an asignment statement:
class example3 { public static void main ( String[] args ) { long payAmount ; //a declaration without an initial value payAmount = 123; //an assignment statement System.out.println("The variable contains: " + payAmount ); } }
The assignment statement puts the value 123 into the variable. In other words, while the program is executing (on the Java pseudocomputer) there will be a 64 bit block of memory that gets the value 123.
Remember that the word "execute" is usually used for "run." One speaks of "executing a program" or "executing" a line of the program.