Java Reference
In-Depth Information
Suppose the input is 3 . What is the value of beta after the following Java
code executes? (Assume that all variables are declared properly.)
beta = console.nextInt();
21.
switch (beta)
{
case 3:
beta = beta + 3;
case 1:
beta++;
break ;
4
case 5:
beta = beta + 5;
case 4:
beta = beta + 4;
}
Suppose the input is 6 . What is the value of a after the following Java code
executes? (Assume that all variables are declared properly.)
a = console.nextInt();
22.
if (a > 0)
switch (a)
{
case 1:
a = a + 3;
case 3:
a++;
break ;
case 6:
a = a + 6;
case 8:
a = a * 8;
break ;
default :
a- -;
}
else
a = a + 2;
In the following code, correct any errors that would prevent the program
from compiling or running:
public class Errors
{
23.
public static void main(String[] args)
{
int a, b;
boolean found;
Search WWH ::




Custom Search