Implementing Classes 2 Flashcards
1) A UML Notation Convention
It it conventional in UML Notation to u___________ any attributes or methods that will be s_________
underline
static
2) API stands for:
A______________ P________________ I__________________
API is the acronym for Application Programming Interface, which is a software intermediary that allows two applications to talk to each other. Each time you use an app like Facebook, send an instant message or check the weather on your phone, you’re using an API.
Application Programing Interface
3) JOption Pane
Another useful class is JOptionPane, which provides p__________ dialogue boxes to get information from users and display messages using G______________ U__________ I____________ dialogue boxes
prepackaged
graphical user interface
4) Do we need to import the JOptionPane class?
Yes
5) Where do we import the JOptionPane class from?
From the Java extension ‘s_______’ packages (javax.swing)
swing
6) What do Java extension ‘swing’ packages do?
They help developers provide a GUI for their applications
7) What do we type to import the JOptionPane Class?
import j____.s_____.JOptionPane;
import javax.swing.JOptionPane;
8) Using JOptionPane Class to make dialogue boxes.
Here is an example:
import javax.swing.JOptionPane; // import class JOptionPane
public class GUI_IO
{
String name = “default name”;
public void basicMessage()
{
JOptionPane.showMessageDialog(null, “Welcome\nto\nJava\nProgramming!” );
}
a) What does the ‘null’ perameter do?
b) What does the \n do?
a) It centers the dialogue box
b) It creates a new line.
9) Using the JOptionPane allows us to dispense with the services of the S_________ class
Scanner
10) Take a look at the following method snippet which uses JOptionPane to create a dialogue box.
public void basicPromptDisplay()
{
name = JOptionPane.showInputDialog(“What is your name”);
The showInputDialog() method can only accept S________.
So, how would we input other things like numbers?
Strings
We would use ‘wrapper’ classes.
11) Wrapper Classes
For every intrinsic primitive data type Java provides a corresponding c_____.
The name of the class is similar to the basic type but begins with a capital letter.
For example – Integer, Character, Float, Double.
These classes are caller w___________ classes.
class
wrapper
12) These are called wrapper classes, because they wrap around the basic type, and add some very useful m_________
to it.
methods
13) Some wrapper classes allow us to convert, for example, letters into numbers.
When someone enters a number in a box on a screen, it is always read as a S______.
If this input was intended as numerical, then we would have to convert it to an int or a double.
String
14) How many wrapper classes are there in Java?
8
Every primitive data type, e.g. int, double, float, has a wrapper class.