Java Data Types Flashcards

1
Q

Equals method of a primitive wrapper class

A
  1. symmetric => a.equals(b) returns same as b.equals(a)
  2. transitive => if a.equals(b) and b.equals(c) return true, then a.equals(c) returns true.
  3. reflexive => a.equals(a) return true.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Boolean

constructors

A

Boolean class has two constructors - Boolean(String) and Boolean(boolean) . The String constructor allocates a Boolean object representing the value true if the string argument is not null and is equal, ignoring case, to the string “true”. Otherwise, allocate a Boolean object representing the value false.

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

Final variable

A

Must be initialized either in an instance block or in a constructor.

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

Modifiers

static and final

A

static and final are valid modifiers for both member field and method declarations within a class.

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

Modifiers

transient and volatile

A

transient and volatile modifiers are only valid for member field declarations.

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

Modifiers

abstract and native

A

abstract and native are only valid for member methods.

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