Use jave excepetions knowledge to slove this question. Code below: import javafx
ID: 3689797 • Letter: U
Question
Use jave excepetions knowledge to slove this question.
Code below:
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.FlowPane;
import javafx.scene.shape.Circle;
import javafx.stage.Stage;
public class MyJavaFX extends Application {
@Override // Override the start method in the Application class
public void start(Stage primaryStage) {
// Create a button and place it in the scene
FlowPane pane = new FlowPane();
Circle circle = new Circle(40);
pane.getChildren().add();
Scene scene = ;
primaryStage.setTitle("Circle Display"); // Set the stage title
; // Place the scene in the stage
primaryStage.show(); // Display the stage
}
public static void main(String[] args) {
}
}
Explanation / Answer
Answer:
Program will print following statements.
Index was out of bounds
Done
Explanation:
Your numbers array have a capacitiy of holding 10 elements but you are trying to access 11 th one. Thats why it throws ArrayIndexOutOfBoundsException. Since you mentioned ArrayIndexOutOfBoundsException exception in your catch block explicitly that ctach block will hanlde that exception. So Index was out of bounds statment will print in console and followed by Done will print in console.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.