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"); Continues...
Escuela, estudio y materia
- Institución
- CSC 201
- Grado
- CSC 201
Información del documento
- Subido en
- 28 de febrero de 2023
- Número de páginas
- 9
- Escrito en
- 2022/2023
- Tipo
- Examen
- Contiene
- Preguntas y respuestas
Temas
-
csc 201
-
csc 201 quiz 7 latest update 2023