CSC 201 - Quiz 7 Latest Update 2023
Suppose A is an inner class in Test. A is compiled into a file named _________. A. A.class B. Test$A.class C. A$T D. Test&A.class - ANS-Test$A.class Suppose A is an anonymous class in Test. A is compiled into a file named _________. A. A.class B. Test$A.class C. A$T D. Test& E. Test$ - ANS-Test$ Analyze the following code. import cation.Application; import .Scene; import ol.Button; import .Stage; public class Test 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 Button btOK = new Button("OK"); btOK.setOnAction(e - Sln("OK 1")); btOK.setOnAction(e - Sln("OK 2")); Scene scene = new Scene(btOK, 200, 250); primarySTitle("MyJavaFX"); // Set the stage title primarySScene(scene); // Place the scene in the stage primaryS(); // Display the stage } /** * The main method is only needed for the IDE with limited JavaFX * support. Not needed for running from the command line. */ public static void main(String[] args) { launch(args); } } A. When clicking the button, the program displays OK1 OK2. B. When clicking the button, the program displays OK1. C. When clicking the button, the program displays OK2. D. The program has a compile error, because the setOnAction method is invoked twice. - ANS-When clicking the button, the program displays OK2. Analyze the following code. import cation.Application; import .ActionEvent; import .EventHandler; import .Scene; import ol.Button; import .Stage; public class Test extends Application { @Override // Override the start method in the Application class public void start(Stage primaryStage) { Button btOK = new Button("OK"); btOK.setOnAction(new EventHandlerActionEvent() { public void handle(ActionEvent e) { Sln("The OK button is clicked"); } }); Scene scene = new Scene(btOK, 200, 250); primarySTitle("MyJavaFX"); // Set the stage title primarySScene(scene); // Place the scene in the stage primaryS(); // Display the stage } /** * The main method is only needed for the IDE with limited JavaFX * support. Not needed for running from the command line. */ public static void main(String[] args) { launch(args); } } A. The program has a compile error because no handlers are registered with btOK. B. The program has a runtime error because no handlers are registered with btOK. C. The message "The OK button is clicked" is displayed when you click the OK button. Continues...
École, étude et sujet
- Établissement
- CSC 201
- Cours
- CSC 201
Infos sur le Document
- Publié le
- 28 février 2023
- Nombre de pages
- 9
- Écrit en
- 2022/2023
- Type
- Examen
- Contenu
- Questions et réponses
Sujets
- csc 201
- quiz 7
- latest update 2023
-
csc 201 quiz 7 latest update 2023