Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

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) {
    
}
}

QUESTION 4 Which of the following strings are printed as output of the following program? Note that you may use Eclipse to check your answer! public class TestExceptions public static void main(String args) intl numbers new int 10]; try numbers[11] 1; System.out.println("Success!"); lcatch (ArraylndexOutOfBoundsException ex) System.out.println("Index was out of bounds"); catch (Exception ex) [ System.out.println("Something went wrong"); System.out.println("Done"); Success A. Not printed Done Index was out of bounds Something went wrong B. Printed

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.