public class IncrDemo
{
public static void main(String[] args)
{
int myVal, yourVal;
myVal = 10;
System.out.println("My initial value is " + myVal);
yourVal = ++myVal;
System.out.println("My new value is " + myVal);
System.out.println("Your value is " + yourVal):
}
}
?
Using the above code, describe how the three println output commands will appear. Explain the values stored in the variables during code execution.
What will be an ideal response?
The myVal variable is initialized to 10. The first println statement will display:"My initial value is 10".?myVal is then incremented by 1 and the value is stored in yourVal. At this point, both myVal and yourVal have a value of 11.?The second println statement will display:"My new value is 11."?And the third println statement will display:"Your value is 11."
Computer Science & Information Technology
You might also like to view...
To set up Twitter for mobile use, click the ________ button in the toolbar, click Settings, and then select the Mobile tab
A) mobile B) gear C) smartphone D) at sign (@)
Computer Science & Information Technology
_________, a typographic feature, measures the amount of space between words.?
Fill in the blank(s) with the appropriate word(s).
Computer Science & Information Technology