Library Classes Flashcards

1
Q

define package

A

a package is a collection of classes containing different built-in function

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

what is java.awt used for

A

contains classes to implement Graphical User Interface

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

what does the asterisk (*) sign indicate

A

that all the classes of the imported package can be used in a program

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

define primitive data types

A

fundamental or basic data types which are created by the system developers.

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

define composite data types

A

it is a set of primitive data types

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

what is Wrapper Class

A

a built-in data type, composite, is called wrapper class

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

function of Integer.parseInt()

A

to convert a string into integer data type

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

function of Integer.toString()

A

convert integer data type to string

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

need of wrapper class

A
  1. store primitive values in objects
  2. to convert a string to other data types, and vice versa
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

general syntax for converting string to primitive data types

A
  1. <primitive> variable= <wrapperclass>.parse<datatype>(String argument);
    </datatype></wrapperclass></primitive>
  2. <primitive> variable= <wrapperclass>.valueOf(String argument);

    </wrapperclass></primitive>

int x= Integer.parseInt(s1)
int x= Integer.valueOf(s1)

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

condition for conversion from string to primitive data type

A

only when the string contains only numbers.
if letters are used, then java throws NumberFormatException error

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

general syntax for primitive data type to string

A

String variable== Integer.toString(int argument);

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

how many ASCII characters are there

A

256, but only 128 characters are used

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

ASCII for 0-9

A

48-57

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

ASCII for A-Z

A

65-90

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

ASCII for a-z

A

97-122

17
Q

ASCII for blank space

A

32

18
Q

syntax for inputting character through scanner class

A

char ch= sc.next().charAt(0);

19
Q

syntax of inputting character through InputStreamReader

A

InputStreamReader read= new InputStreamReader(System.in);
BufferedReader in= new BufferedReader(read);
char ch= (char)(in.read());

20
Q

what is Character.isLetter(character) used for

A

to check whether a character is a letter or not

21
Q

what is Character.isLetterOrDigit(char) used for

A

if a character is a letter or digit, it returns true. otherwise, returns false.

22
Q

how to convert uppercase character to lowercase using ASCII

A

1.get ASCII of uppercase character
2. increase ASCII by 32
3. convert back to char form, for corresponding letter

vice versa for lowercase to uppercase

23
Q

define autoboxing

A

the automatic conversion of a primitive data type into an object of its equivalent Wrapper class is called Autoboxing

24
Q

syntax of autoboxing

A

<wrapper> <objectname>= new (wrapper class>(Primitive value);
Integer val= new Integer(54);
</objectname></wrapper>

25
Q

need for autoboxing

A
  1. to pass a primitive data type to a function that uses wrapper object as function argument
  2. add a primitive data in the list of array elements
26
Q

define unboxing

A

system of converting an object of wrapper class into primitive data type. it is the opposite of autoboxing.

27
Q

need for unboxing

A
  1. to pass a value from wrapper object to a function have argument as primitive
  2. when a data from array list is to be used as primitive data types.