Programming in Java
Which four options describe the correct default values for array elements of the types indicated?
int -> 0
String -> "null"
Dog -> null
char -> '\u0000'
float -> 0.0f
boolean -> true
1, 3, 4, 5
1, 2, 3, 4
2, 4, 5, 6
3, 4, 5, 6
Which will legally declare, construct, and initialize an array?
int myList [] = {4, 3, 7};
int myList [] [] = {4,9,7,0};
int [] myList = (5, 8, 2);
int [] myList = {"1", "2", "3"};
Which is a reserved word in the Java programming language?
native
method
subclasses
reference
Which is a valid keyword in java?
interface
string
Float
unsigned
Which is the valid declarations within an interface definition?
public double methoda();
public final double methoda();
static void methoda(double d1);
protected void methoda(double d1);
Which one is a valid declaration of a boolean?
boolean b3 = false;
boolean b1 = 0;
boolean b4 = Boolean.false();
boolean b5 = no;
Which three are valid declarations of a float?
float f1 = -343;
float f2 = 3.14;
float f3 = 0x12345;
float f4 = 42e7;
float f5 = 2001.0D;
float f6 = 2.81F;
1, 3, 6
1, 2, 4
2, 3, 5
2, 4, 6
Which is a valid declarations of a String?
String s1 = null;
String s2 = 'null';
String s3 = (String) 'abc';
String s4 = (String) '\ufeed';
What is the numerical range of a char?
0 to 65535
0 to 32767
-(215) to (215) - 1
-128 to 127
You want subclasses in any package to have access to members of a superclass. Which is the most restrictive access that accomplishes this objective?
protected
private
public
transient