Latest Update
If you have a pane named "pane1" and an inner listener class named "PaneHandler", how do
you register the "pane1" to listen to the mouse pressed
event? pane1.setOnMousePressed(new paneHandler());
Which code creates a ComboBox called 'comboColor" and assign the following strings options
choose from: "Black", "Blue" and Yellow" it?
a) ComboBox comboColor = new ComboBox();
comboColor.add("Black", "Blue" , "yellow);
b) ComboBox comboColor = new ComboBox();
comboColor.setItems("Black", "Blue" , "yellow);
c) ComboBox comboColor = new ComboBox();
comboColor.setItems().add("Black", "Blue" , "yellow);
d) ComboBox comboColor = new ComboBox();comboColor.getItems().addAll("Black", "Blue" ,
"yellow); d) ComboBox comboColor = new
ComboBox();comboColor.getItems().addAll("Black", "Blue" , "yellow);
In order to display three components (nodes) vertically in a pane, you could use all but which of
the following layout managers given the size of the Pane is fixed.
a) VBox
,b) Flow
c) Grid
d) BorderPane b) Flow
Use the code below to answer the next question Note that the catch statements in the code are
not implemented, but you will not need those details. Assume filename is a String, x is an int, a
is a double array and i is an int. Use the comments i1, i2, i3, e1, e2, e3, e4, e5 to answer the
questions (i for instruction, e for exception handler).
An exception raised by the instruction in i1 would be caught by the catch statement labeled
try { BufferedReader infile = new BufferedReader(new FileReader(filename)); // i1 int x =
Integer.parseInt(infile.readLine( )); // i2 a[++i] = (double) (1 / x); // i3 } catch
(FileNotFoundException ex) {...} // e1 catch (NumberFormatException ex) {...} // e2 catch
(ArithmeticException ex) {...} // e3 catch (ArrayIndexOutOfBounds ex) {...} // e4 catch
(IOException ex) {...} // e5
a) e2
b) e1
c) either e1 or e5
d) e5 b) e1
Use the code below to answer the next question Note that the catch statements in the code are
not implemented, but you will not need those details. Assume filename is a String, x is an int, a
,is a double array and i is an int. Use the comments i1, i2, i3, e1, e2, e3, e4, e5 to answer the
questions (i for instruction, e for exception handler).
An exception raised by the instruction in i2 would be caught by the catch statement labeled
try { BufferedReader infile = new BufferedReader(new FileReader(filename)); // i1 int x =
Integer.parseInt(infile.readLine( )); // i2 a[++i] = (double) (1 / x); // i3 } catch
(FileNotFoundException ex) {...} // e1 catch (NumberFormatException ex) {...} // e2 catch
(ArithmeticException ex) {...} // e3 catch (ArrayIndexOutOfBounds ex) {...} // e4 catch
(IOException ex) {...} // e5
a) either e2 or e5
b) e2
c) e5
d) e1 a) either e2 or e5
_________ the process of using the same method name for multiple methods with different
definitions when their signatures are different.
a) method overriding
b) method overloading
c) constructor
d) static method b) method overloading
The idea that an object can exist separate from the executing program that creates it is called
, a) transcience
b) static
c) persistence
d) serialization c) persistence
Which method must be implemented if a class implements EventHandler interface?
a) public void start (Stage st1)
b) public void update()
c) public void handle(ActionEvent e)
d) None of the above c) public void handle(ActionEvent e)
A TextArea can be used to display text, but not to edit text by the user.
True
False False
A mouse event is generated by
a) pressing the mouse