Java Standard Library Flashcards

1
Q

JOptionPane

A

A GUI for text input and output located in javax.swing

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

showInputDialog(String prompt)

A

Prints the prompt and returns the string entered by user

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

showMessageDialog(String message)

A

Generates a message box

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

showConfirmDialog()

A

Generates a message box

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

showConfirmDialog(null, prompt, title, optionType)

A

Creates a confirmation window

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

java.lang

A

General support - string, integer, float, math

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

Package for general utilities

  • random numbers
  • currency
  • calendar
  • data structures
A

java.util

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

Package for formatting text

  • dates
  • currency
A

java.text

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

Package for basic graphics & GUIs

A

java.awt

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

Package extending awt with advanced GUIs

A

javax.swing

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

Package with functions for I/O and formatting

A

java.io

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

Package for writing applets

A

java.applet

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

Which package is automatically imported into all programs?

A

java.lang

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

String method for length

A

S.length();

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

String method for comparing the content of strings. Return type.

A

s.equals(t);

Boolean

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

String method for comparing lexicographically. Return type.

A

s.compareTo(t);

0 - equal
> 0 - First string greater
< 0 - Second string is greater

17
Q

String method for comparing address references

A

==

18
Q

String method for lexicographical comparison disregarding case

A

s.compareToIgnoreCase(t);

19
Q

String method to access a character at a given index (0 to length - 1)

A

char c = s.charAt(0);

20
Q

String method for changing case

A

String x = s.toLowerCase();

String x = s.toUpperCase;

21
Q

Absolute value method

A

double x = Math.abs(-14.3);

22
Q

Square Root Method

A

double x = Math.sqrt(2.0);

23
Q

Trig methods

A

double x = Math.cos(y);

double x = Math.sin(y);

24
Q

Powers method

A

double x = Math.pow(base, exponent);

25
Q

Random numbers method

Return range

A

double x = Math.random();

0.0 to 1.0

26
Q

The class that formats text

A

Number Format in java.text

27
Q

Currency Conversion

A

Generate a currency object assigned to x
NumberFormat.getCurrencyInstance();

Generate the String
Double amount = 123.5
x.format(amount);

28
Q

Percentage Conversion

A

Generate a percent object assigned to x
NumberFormat.getPercentInstance();

Generate a string & format
double taxrate = 0.079;
percent.format(taxrate);