subject

Consider the following code segment. boolean a = true;
boolean b = false;
System. out. print((a == !b) != false);
What is printed as a result of executing this code segment?
false
true
0
1
Nothing is printed because the expression (a == !b) != false is an invalid parameter to the System. out. print method.
The following code segment prints one or more characters based on the values of boolean variables b1 and b2. Assume that b1 and b2 have been properly declared and initialized.
if (!b1 || b2)
{
System. out. print("A");
}
else
{
System. out. print("B");
}
if (!(b1 || b2))
{
System. out. print("C");
}
else
{
System. out. print("D");
}
if (b1 && !b1)
{
System. out. print("E");
}
If b1 and b2 are both initialized to true, what is printed when the code segment has finished executing?
ABCD
ABD
AD
BD
BDE
Consider the following code segment.
String str1 = new String("Happy");
String str2 = new String("Happy");
System. out. print(str1.equals(str2) + " ");
System. out. print(str2.equals(str1) + " ");
System. out. print(str1 == str2);
What is printed as a result of executing the code segment?
true true true
true true false
false true false
false false true
false false false
Consider the following two code segments. Assume that variables x and y have been declared as int variables and have been assigned integer values.
I.
int result = 0;
if (x > y)
{
result = x - y;
System. out. print(result);
}
else if (x < y)
{
result = y - x;
System. out. print(result);
}
else
{
System. out. print(result);
}
II.
if (x < y)
{
System. out. print(y - x);
}
else
{
System. out. print(x - y);
}

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 19:10
How might the success of your campaign be affected if you haven’t carefully completed all field data or if you accidentally insert the wrong merge field in the document?
Answers: 1
question
Computers and Technology, 23.06.2019 07:00
What are three software programs for mobile computing?
Answers: 1
question
Computers and Technology, 23.06.2019 09:00
What provides an array of buttons for quick access to commonly used commands and tools
Answers: 1
question
Computers and Technology, 23.06.2019 09:20
How to print: number is equal to: 1 and it is odd number number is equal to: 2 and it is even number number is equal to: 3 and it is odd number number is equal to: 4 and it is even number in the console using java using 1 if statement, 1 while loop, 1 else loop also using % to check odds and evens
Answers: 3
You know the right answer?
Consider the following code segment. boolean a = true;
boolean b = false;
System. out....
Questions
question
Mathematics, 29.09.2019 22:10
question
English, 29.09.2019 22:10
Questions on the website: 13722360