Java Reference
In-Depth Information
9.
In the switch statement in the previous question, what would the output be if point
was the value 40?
10.
What is the output of the following code?
double rate = 1.5;
double price = 0.0;
if(rate >= 0.0 && rate < 1.0)
{
price = 20 * rate;
}
else if(rate >= 1.0 && rate < 2.0)
{
price = 15 * rate;
}
else if(rate >= 2.0)
{
price = 10 * rate;
}
System.out.println(price);
11.
What would the output be in the code in the previous question if the value of rate
was -0.75?
12.
How many times does the following loop repeat? What is the output?
byte b = 1;
do
{
b++;
}while(!(b < 10));
System.out.println(b);
13.
What is the output of the following code?
int y = 100, x = 5;
while(y > 0)
{
y--;
if(y%x != 0)
{
continue;
}
System.out.println(y);
}
Search WWH ::




Custom Search