Java programming
1) Which among the choices is the following Java expression equivalent to?
!((b != 0) || (c <= 5))
Select one:
a) (b != 0) && (c <= 5)
b) (b == 0) && (c > 5)
c) !((b <> 0) && (c <= 5))
d) (! (b = 0)) && (! (c > 5))
e) (b == 0) && (c <= 5)
2) The scope of a variable is an important feature in Java, the following variable was declared in the header of a Java class, what is the scope of this variable?
public static int headerOne = 1;
Select one:
a) The variable is global and static enables unrestricted access to the variable from any JRE.
b) The variable is local to the class it was initialized and can only be accessed when an instance of the class has been created.
c) The variable is local and can only be accessed within the method it was initialized.
d) The variable is local to the class it was initialized and can be accessed without creating an instance of the class.
e) The variable is local to the method it was initialized and can only be accessed by an instances of that method.
Question 1: !((b != 0) || (c <= 5)) the choices is the Java expression equivalent to is (b == 0) && (c > 5) So, answer is option b Answer: b) (b == 0) && (c > 5) Question 2: public static int headerOne = 1; the scope of this variable The variable is local to the class it was initialized and can be accessed without creating an instance of the class. So, answer is option d Answer: d) The variable is local to the class it was initialized and can be accessed without creating an instance of the class.
Get Answers For Free
Most questions answered within 1 hours.