<< Chapter < Page | Chapter >> Page > |
When the plus operator (+) is used as a concatenation operator, what is the nature of its behavior if its left operand is of type String and its right operand is not of type String ? If the right operand is a variable that is not of type String , what is the impact of this behavior on that variable.
Show and describe four unary arithmetic operators supported by Java.
What is the type returned by relational operators in Java?
Show and describe six different relational operators supported byJava.
Show the output that would be produced by the Java application shown in Listing 2 .
Listing 2 . Listing for Question 22. |
---|
class relat01 { //define the controlling class
public static void main(String[]args){ //define main
System.out.println("The relational 6<5 is " + (6<5 ));
System.out.println("The relational 6>5 is " + (6>5 ));
}//end main}//End relat01 class. Note no semicolon required
//End Java application |
Show and describe three operators (frequently referred to as conditional or logical operators) that are often combined with relational operators to construct more complex expressions (often called conditional expressions) . Hint: The || operator returns true if either the left operand, the right operand, or both operands are true. What are the other two and how do theybehave?
Describe the special behavior of the || operator in the following expression for the case where the value of the variable a is less than the value of the variable b .
(a<b) || (c<d)
Show the symbols used for the bitwise and operator and the bitwise inclusive or operator.
Show and describe seven operators in Java that perform actions on the operands one bit at a time (bitwise operators) .
True or false? In Java, the signed right shift operation populates the vacated bits with the zeros, while the left shift and the unsigned right shift populate the vacated bits with the sign bit. If your answer is False,explain why.
True or false? In a signed right-shift operation in Java, the bits shifted off the right end are lost. If your answer is False, explain why.
Using the symbols 1 and 0, construct a truth table showing the four possible combinations of 1 and 0. Using a 1 or a 0, show the result of the bitwise and operation on these four combinations of 1 and 0.
Using the symbols 1 and 0 construct a truth table showing the four possible combinations of 1 and 0. Using a 1 or a 0, show the result of the bitwise inclusive or operation on these four combinations of 1 and 0.
Using the symbols 1 and 0 construct a truth table showing the four possible combinations of 1 and 0. Using a 1 or a 0, show the result of the bitwise exclusive or operation on these four combinations of 1 and 0.
True or false? For the exclusive or , if the two bits are different, the result is a 1. If the two bits are the same, the result is a 0. If youranswer is False, explain why.
Notification Switch
Would you like to follow the 'Object-oriented programming (oop) with java' conversation and receive update notifications?