Write an exception class that can be thrown when a negative number is passed to a method.
> Which of the following are illegal variable names and why? x 99bottles july97 theSalesFigureForFiscalYear98 r&d grade_report
> What will the following program display on the screen? public class CheckPoint { public static void main(String[] args) { int number; number = 712; System.out.println("The value is " + "number"); } }
> Examine the following program. // This program uses variables and literals. public class BigLittle { public static void main(String[] args) { int little; int big; little = 2; big = 2000; System.out.println("The little number is " + little); System.out.pr
> The following program will not compile because the lines have been mixed up. public static void main(String[] args) } // A crazy mixed up program public class Columbus { System.out.println("In 1492 Columbus sailed the ocean blue."); } } When the lines ar
> Assume a JavaFX application has a Button control named myButton, and a Label control named outputLabel. Write an event handler class that can be used with the Button control. The event handler class should display the string “Hello World†in outputLab
> Write an if statement that assigns 100 to x when y is equal to 0.
> What import statement do you write in a program that uses the JOptionPane class?
> Write code that displays an input dialog asking the user to enter his or her age. Convert the input value to an int and store it in an int variable named age.
> Write code that will display each of the dialog boxes shown in Figure2-19.
> What is the purpose of the following types of dialog boxes? Message dialog Input dialog
> How are documentation comments different from other types of comments?
> How do you write a single line comment? How do you write a multi-line comment? How do you write a documentation comment?
> Assume that lowerCity is a String reference variable. Write a statement that stores the lowercase equivalent of the string referenced by the city variable in lowerCity.
> Assume that upperCity is a String reference variable. Write a statement that stores the uppercase equivalent of the string referenced by the city variable in upperCity.
> Assume that oneChar is a char variable. Write a statement that stores the first character in the string referenced by the city variable in oneChar.
> What is data hiding?
> Write a statement, after the following code, that creates an HBox container, and adds the label1, label2, and label3 controls to it: Label label1 = new Label("One"); Label label2 = new Label("Two"); Label label3 = new Label("Three");
> What is encapsulation?
> What are an object’s methods?
> What are an object’s attributes?
> In procedural programming, what two parts of a program are typically separated?
> What is the purpose of testing a program with sample data or input?
> Is a syntax error (such as misspelling a key word) found by the compiler or when the program is running?
> What is a runtime error?
> Describe what a compiler does with a program’s source code.
> What is pseudocode?
> What does it mean to “visualize a program running� What is the value of such an activity?
> Write a statement that creates an object that can be used to write binary data to the file Configuration.dat.
> What four items should you identify when defining what a program is to do?
> What is the JVM?
> What is byte code?
> What is a syntax error?
> What is a compiler?
> What happens to a variable’s current contents when a new value is stored there?
> Why are variables called “variable�
> Describe the difference between a program line and a statement.
> Describe the difference between operators and punctuation symbols.
> Describe the difference between a key word and a programmer-defined symbol.
> The method getValueFromFile is public and returns an int. It accepts no arguments. The method is capable of throwing an IOException and a FileNotFoundException. Write the header for this method.
> What type of file does Scene Builder save a GUI to?
> What is FXML?
> What type of scene graph node can have children? What type cannot?
> What are the three types of nodes in a scene graph?
> What is a scene graph?
> What is an event? What is an event listener?
> What is a component?
> What method do you call to change an ImageView’s image?
> What ImageView property do you set in the Inspector panel to display an image?
> Do you normally add RadioButtons or CheckBoxes to a toggle group?
> What is the purpose of a toggle group?
> You want the user to be able to select any number of items from a group of items. Which type of component would you use for the items, RadioButtons or CheckBoxes?
> You want the user to be able to select only one item from a group of items. Which type of component would you use for the items, RadioButtons or CheckBoxes?
> What is JavaFX?
> How do you register an event listener to a component in Scene Builder?
> How do you register a controller class to an application’s GUI in Scene Builder?
> What is an event listener?
> What is the controller class?
> In general, what operations does the main application class perform?
> What is an fx:id?
> Write a method that searches a numeric array for a specified value. The method should return the subscript of the element containing the value if it is found in the array. If the value is not found, the method should throw an exception of the Exception c
> Which Scene Builder panel allows you to work with a component’s properties, Âlayout, and code?
> Which Scene Builder panel shows the scene graph?
> Which Scene Builder panel do you use to visually design an application’s GUI?
> Which Scene Builder panel provides a list of JavaFX components?
> What is a GUI?
> What statement would you write in an HTML document to display the text “Hello World†in bold and italic?
> What statement would you write in an HTML document to display the text “My Resume†in bold and centered on the page?
> What statement would you write in an HTML document to display the text “Student Roster†as a level one header?
> What tag marks the beginning and end of an HTML document’s body section?
> What statement would you use in an HTML document to display the text “My Web Page†in the browser’s title bar? What section of the HTML document would this statement be written in?
> Assume that the reference variable r refers to a serializable object. Write code that serializes the object to the file ObjectData.dat.
> What tag marks the beginning and end of an HTML document’s head section?
> What is the difference between the Applet class’s getDocumentBase and getCodeBase methods?
> What methods does an AudioClip object have? What do they do?
> What is the difference between using the Applet method asked for in Checkpoint19.35 , and using an AudioClip object to play a sound file?
> What Applet method can you use to play a sound file?
> How to you cause a Timer object to cease generating action events?
> How do you cause a Timer object to begin generating action events?
> How are the time intervals between a Timer object’s action events measured?
> What type of events do Timer objects generate?
> What is an adapter class, and how does it make some programming tasks easier?
> Look at the following program and tell what it will output when run: public class ExceptionTest { public static void main(String[] args) { int number; String str; try { str = "xyz"; number = Integer.parseInt(str); System.out.println("A"); } catch(NumberF
> What tag marks the beginning and end of an HTML document?
> If a class implements the MouseListener interface but does not need to use all of the methods specified by the interface, can the definitions for those methods be left out? If not, how are these methods dealt with?
> What type of object do mouse listener and mouse motion listener methods accept? What methods do these types of objects provide for determining a mouse cursor’s location?
> What interface would a listener class implement to handle a mouse click event? A mouse press event? A mouse dragged event? A mouse release event? A mouse move event?
> What is the difference between a mouse press event and a mouse click event?
> What Graphics class methods do you use to perform the following tasks? 1. Draw a line. 2. Draw a filled rectangle. 3. Draw a filled oval. 4. Draw a filled arc. 5. Set the drawing color. 6. Draw a rectangle. 7. Draw an oval. 8. Draw an arc. 9. Draw a stri
> What values are contained in the two arrays that are passed to a Graphics object’s drawPolygon method?
> When using a Graphics object to draw an oval, what invisible shape is the oval enclosed in?
> How do you force the paint or paintComponent method to be called?
> In the paint or paintComponent method, what should be done before anything else?
> Look at the following interface: public interface Computable { double compute(double x); } Write a statement that uses a lambda expression to create an object that implements the Computable interface. The object’s name should be half. The half objectâ€
> When are the paint and paintComponent method called?
> Why do applets run in a restricted environment?
> In a JPanel object, do you override the paint or paintComponent method to get a reference to the Graphics object?
> In an AWT component, or a class that extends JApplet or JFrame, if you want to get a reference to the Graphics object, do you override the paint or paintComponent method?
> In Swing, if an object’s class extends JFrame or JApplet, you add components to its content pane. How do you add components to an object if its class extends Frame or Applet?
> To create an applet using AWT, what class do you inherit your applet class from?
> Suppose the file MyApplet.java contains the Java source code for an applet. What tag would you write in an HTML document to run the applet in an area that is 400 pixels wide by 200 pixels high?