receive events?
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.stage.Stage;
import javafx.application.Platform;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.scene.control.Button;
public class TestFX extends Application {
public void start(Stage stage) {
Button quitButton = new Button("Quit");
quitButton.setOnAction(e -> Platform.exit());
HBox buttonBar = new HBox(quitButton);
BorderPane root = new BorderPane();
root.setBottom(buttonBar);
Scene scene = new Scene(root, 100, 50);
stage.setScene(scene);
stage.show();
}
public static void main(String[] args) {
launch(args);
}
}
Select one:
a.
import javafx.scene.control.Button;
b.
Button quitButton = new Button("Quit");
c.
quitButton.setOnAction(e -> Platform.exit());
,d.
root.setBottom(buttonBar);
e.
stage.setScene(scene);
Feedback
Your answer is correct.
Which of the following should be used to compare the contents of two String
objects in Java?
Select one:
a.
=
b.
==
c.
cmp
d.
equals
e.
?
Feedback
Your answer is correct.
Which one of the following is used in Java programming to handle
asynchronous events?
Select one:
a.
event handlers
b.
pragmatics
, c.
protocols
d.
reserved words
e.
short circuits
Feedback
Your answer is correct.
Which of the following keywords is useful for getting out of an infinite loop?
Select one:
a.
break
b.
continue
c.
do
d.
switch
e.
while
Feedback
Your answer is correct.
What is the output of the following Java program?
import java.util.*;
class ArrayGames {
public static void main(String[] args) {
int[] a = {1,2,3,4,5};
for (int i = 0; i < a.length; i++) a[i] = a[i-1];
System.out.println(Arrays.toString(a));