A try block can't define multiple finally blocks.
Select one:
True
False - ANSWER-False
class Base {
public void foo() { System.out.println("Base"); }
}
class Derived extends Base {
private void foo() { System.out.println("Derived"); }
} - ANSWER-False
class Truck extends Car{
String engineType = "X 15 engine";
Truck(){
super();
}
} - ANSWER-Inheritance
class Truck{
Engine engine;
Truck(Engine engine){
this.engine = engine;
engine.start();
}
} - ANSWER-Aggregation
Correct the code fragment
public void start(Stage primaryStage) {
javafx.scene.shape.Circle circle = new javafx.scene.shape.Circle(200, 150, 50);
circle.setFill(Color.RED);
Scene scene = new Scene(circle, 400, 400);
primaryStage.setScene(scene); // Place the scene in the stage
primaryStage.show(); // Display the stage
} - ANSWER-public void start(Stage primaryStage) {
javafx.scene.shape.Circle circle = new javafx.scene.shape.Circle(200, 150, 50);
circle.setFill(Color.RED);
Group group = new Group(circle);
Scene scene = new Scene(group, 400, 400);
primaryStage.setScene(scene); // Place the scene in the stage
, primaryStage.show(); // Display the stage
}
Correct the following code
public class D {
private double mass;
D() {
this(10.);
System.out.println("No-arg constructor");
}
D(double mass){
System.out.println("Constructor");
mass = mass;
}
public double getMass() {
return mass;
}
public void setMass(double mass) {
D.mass = mass;
}
} - ANSWER-public class D {
private double mass;
D() {
this(10.);
System.out.println("No-arg constructor");
}
D(double mass){
System.out.println("Constructor");
this.mass = mass;
}
public double getMass() {
return mass;
}
public void setMass(double mass) {
this.mass = mass;
}
}
File object creates a file on the disk:
java.io.File file = new java.io.File("students.txt");
Select one:
True
False - ANSWER-False