Given the definition of the Vehicle class:
class Vehicle {
String name;
void setName (String name) {
this.name = name;
}
String getName() {
return name;
}
}
Which action encapsulates the Vehicle class?
A. Make the Vehicle class public.
B. Make the name variable public.
C. Make the setName method public.
D. Make the name variable private.
E. Make the setName method private.
F. Make the getName method private.
Given:
public final class IceCream {
public void prepare() {}
}
public class Cake {
public final void bake(int min, int temp) {}
public void mix() {}
}
public class Shop {
private Cake c = new Cake ();
private final double discount = 0.25;
public void makeReady () { c.bake(10, 120); }
}
public class Bread extends Cake {
public void bake(int minutes, int temperature) {}
public void addToppings() {}
}
Which statement is true?
A. A compilation error occurs in IceCream.
B. A compilation error occurs in Cake.
C. A compilation error occurs in Shop.
D. A compilation error occurs in Bread
E. All classes compile successfully.
Which statement is true about java.util.stream.Stream?
A. A stream cannot be consumed more than once.
B. The execution mode of streams can be changed during processing.
C. Streams are intended to modify the source data.
D. A parallel stream is always faster than an equivalent sequential stream.
Given:

and the code fragment: What is the result?

A. 0.0
B. 1500.0
C. A compilation error occurs.
D. 2000.0
Given the code fragments:

and

What is the result?
A. null B. A compilation error occurs.
C. DogCatMouse
D. [Dog, Cat, Mouse]
Given that data.txt and alldata.txt are accessible, and the code fragment: What is required at line n1 to enable the code to overwrite alldata.txt with data.txt?

A. br.close();
B. bw.writeln();
C. br.flush();
D. bw.flush();
Given:
public class Canvas implements Drawable {
public void draw () { }
}
public abstract class Board extends Canvas { }
public class Paper extends Canvas {
protected void draw (int color) { }
}
public class Frame extends Canvas implements Drawable {
public void resize () { }
abstract void open ();
}
public interface Drawable {
public abstract void draw ();
}
Which statement is true?
A. Board does not compile.
B. Paper does not compile.
C. Frame does not compile.
D. Drawable does not compile.
E. All classes compile successfully.
Given the code fragment:
LocalDate valentinesDay =LocalDate.of(2015, Month.FEBRUARY, 14);
LocalDate next15days = valentinesDay.plusDays (15);
LocalDate nextYear = next15days.plusYears(1); // line n1
System.out.println(nextYear);
What is the result?
A. 2016-03-01
B. A DateTimeException is thrown.
C. 2016-02-29
D. A compilation error occurs at line n1.
Given the information: Emp table has 10 records. Given the code fragment:

Which code fragment, inserted at Line n1, helps you determine the number of records in ResultSet?
A. ResultSetMetaData rsmd = rs.getMetaData(); int totRows = rsmd.getRowCount();
B. int totRows=0; while(rs.next()){ totRows++; }
C. rs.last(); int totRows = rs.getRowCount();
D. rs.last(); int totRows = rs.getRowId(1);
Given:

and the code fragment:

What is the result?
A. User is registered.
B. An AgeOutOfLimitException is thrown.
C. A UserException is thrown.
D. A compilation error occurs in the doRegister method.