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 02:30
Larry sent an email to andy. andy didn't open larry's email but still understood what the message was. how did andy determine the message without opening the email?
Answers: 1
question
Computers and Technology, 22.06.2019 10:00
Create a word problem that involves calculating the volume and surface area of a three-dimensional object. cube: surface area 6 s2 , volume s3
Answers: 3
question
Computers and Technology, 22.06.2019 23:50
List a few alternative options and input and output over the standerd keyboard and monitor. explain their functioning in details.
Answers: 2
question
Computers and Technology, 23.06.2019 11:30
Auser is given read permission to a file stored on an ntfs-formatted volume. the file is then copied to a folder on the same ntfs-formatted volume where the user has been given full control permission for that folder. when the user logs on to the computer holding the file and accesses its new location via a drive letter, what is the user's effective permission to the file? a. read b. full control c. no access d. modify e. none of the above
Answers: 1
You know the right answer?
Consider the following code segment. boolean a = true;
boolean b = false;
System. out....
Questions
Questions on the website: 13722367