Implementing Classes 2 Flashcards

1
Q

1) A UML Notation Convention

It it conventional in UML Notation to u___________ any attributes or methods that will be s_________

A

underline
static

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

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.

A

Application Programing Interface

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

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

A

prepackaged
graphical user interface

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

4) Do we need to import the JOptionPane class?

A

Yes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

5) Where do we import the JOptionPane class from?

From the Java extension ‘s_______’ packages (javax.swing)

A

swing

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

6) What do Java extension ‘swing’ packages do?

A

They help developers provide a GUI for their applications

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

7) What do we type to import the JOptionPane Class?

import j____.s_____.JOptionPane;

A

import javax.swing.JOptionPane;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

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

a) It centers the dialogue box
b) It creates a new line.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

9) Using the JOptionPane allows us to dispense with the services of the S_________ class

A

Scanner

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

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?

A

Strings
We would use ‘wrapper’ classes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

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.

A

class
wrapper

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

12) These are called wrapper classes, because they wrap around the basic type, and add some very useful m_________
to it.

A

methods

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

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.

A

String

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

14) How many wrapper classes are there in Java?

A

8

Every primitive data type, e.g. int, double, float, has a wrapper class.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly