What does this code fragment print?
int n = 1;
int m = -1;
if (n < -m)
{
System.out.print(n);
}
else
{
System.out.print(m);
}
|
-1 |
|
What does this code fragment print?
double x = Math.sqrt(2);
double y = 2;
if (x * x == y)
{
System.out.println("okay");
}
else
{
System.out.println("oops");
}
|
oops |
|
What does this code fragment print when x is 60?
if (x > 100);
{
x = 100;
}
System.out.println(x); |
100 |
|
What will this code print?
String school = new String("Udacity");
if (school == "Udacity")
{
System.out.println("equal");
}
else
{
System.out.println("not equal");
}
|
not equal |
|
Complete the if statement with the condition to determine whether the string name has a value assigned to it.
if(________________)
|
name != null |
|
Which of the following comes first in lexicographic order?
"John"
"john"
"123" |
"123" |
|
Which of the following comes last in lexicographic order?
"lesson1"
"lesson2"
"lesson10"
|
"lesson2" |
|
done is a boolean variable. What is the value of !!done? |
done |
|