Java Reference
In-Depth Information
System.out.print("Enter the first integer: ");
a = console.nextInt();;
System.out.println();
System.out.print("Enter the second integer: ");
b = console.nextInt();;
if a > a * b && 10 < b
found = 2 * a > b;
else
{
found = 2 * a < b;
if found
a = 3;
c = 15;
if b
{
b = 0;
a = 1;
}
}
}
}
24. The following program contains errors. Correct them so that the program
will run and output w = 21 .
public class Mystery
{
static final int ONE = 5;
public static void main(String[] args)
{
int x, y, w, z;
z = 9;
if z > 10
x = 12;
y = 5,
w = x + y + one;
else
x = 12;
y = 4,
w = x + y + one;
System.out.println("w = " + w);
}
}
Suppose that str1 , str2 , and str3 are String variables, and str1 ΒΌ
"English" , str2 = "Computer Science" , and str3 = "Programming" .
Evaluate the following expressions:
25.
str1.compareTo(str2) >= 0
a.
str1.compareTo("english") != 0
b.
str3.compareTo(str2) < 0
c.
str2.compareTo("Chemistry") >= 0
d.
Search WWH ::




Custom Search