Java Flashcards
what is Encapsulation? How to define a well-encapsulated class?
- private variables
- access to these variables using public method
what is overloaded method?
same class - same name - different parameter list
- what is polymorphic / overridden method?
- relationship among access modifiers of overriding method & overridden method
- classes, that share inheritance
- same name - same number of method arguments - same return type
what is checked exception?
java.lang.Exception
- what is unchecked exception?
- type of unchecked exception? (7)
java.lang.Exception & java.lang.RuntimeException
- what are error?
- type of error? (4)
-
String is immutable –> what does this mean?
- once created, content not modified
- Methods that return a modified String value –> return a new String object
- original String value remains the same
difference method - constructor
-
what happens when a class implements an interface?
-
derived class constructor - base class constructor
a derived class constructor must always call a base class constructor
what values can be passed to case statement in switch?
- compile-time
- null is not accepted
- duplicate values are not accepted
can switch work with Array? What can it work with?
- no
- byte, short, char, and int
- enumerated types
- String
- WrapUp