Java Flashcards

1
Q

what is Encapsulation? How to define a well-encapsulated class?

A
  • private variables

- access to these variables using public method

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

what is overloaded method?

A

same class - same name - different parameter list

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q
  • what is polymorphic / overridden method?

- relationship among access modifiers of overriding method & overridden method

A
  • classes, that share inheritance

- same name - same number of method arguments - same return type

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

what is checked exception?

A

java.lang.Exception

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q
  • what is unchecked exception?

- type of unchecked exception? (7)

A

java.lang.Exception & java.lang.RuntimeException

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

- type of error? (4)

A

-

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

String is immutable –> what does this mean?

A
  • once created, content not modified
  • Methods that return a modified String value –> return a new String object
  • original String value remains the same
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

difference method - constructor

A

-

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

what happens when a class implements an interface?

A

-

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

derived class constructor - base class constructor

A

a derived class constructor must always call a base class constructor

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

what values can be passed to case statement in switch?

A
  • compile-time
  • null is not accepted
  • duplicate values are not accepted
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

can switch work with Array? What can it work with?

A
  • no
  • byte, short, char, and int
  • enumerated types
  • String
  • WrapUp
How well did you know this?
1
Not at all
2
3
4
5
Perfectly