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 14:40
You are working with a professional edition organization. they wish to install the expense tracker which requires the use of 4 custom tabs, 3 custom objects, and one custom app. if the company is already using 4 applications, 36 custom objects, and 7 custom tabs, what will happen when they try to install expense tracker?
Answers: 1
question
Computers and Technology, 23.06.2019 19:30
Anul 2017 tocmai s-a încheiat, suntem trişti deoarece era număr prim, însă avem şi o veste bună, anul 2018 este produs de două numere prime, 2 şi 1009. dorel, un adevărat colecţionar de numere prime, şi-a pus întrebarea: “câte numere dintr-un interval [a,b] se pot scrie ca produs de două numere prime? “.
Answers: 3
question
Computers and Technology, 24.06.2019 00:10
Read each statement below. if the statement describes a peer-to-peer network, put a p next to it. if the statement describes a server-based network, put an s next to it. p - peer-to-peer s - server-based
Answers: 1
question
Computers and Technology, 24.06.2019 01:00
Me if you do then you get 10 points and brainliest
Answers: 1
You know the right answer?
Consider the following code segment. boolean a = true;
boolean b = false;
System. out....
Questions
question
Geography, 17.02.2022 21:30
question
Spanish, 17.02.2022 21:30
question
Mathematics, 17.02.2022 21:30
question
History, 17.02.2022 21:30
question
Biology, 17.02.2022 21:30