Intermidiate Java Concepts Flashcards
(7 cards)
1
Q
What is a constructor?
A
It is a special method that is called when an object of a class is created, it is used to initialize an object of a class.
2
Q
What are the types of constturctors?
A
- Default constructror
- No parameter constructor
- Parameterized constructor
3
Q
What is a default constructor?
A
It is no parameter constructor that is automaticaly provided by the compiler, if not consturctor is defined by the programmer.
4
Q
what are the possible access modifiers in java and what are thier meanings
A
- Private: accesible only withing the same class
- Public: Accesible from any class
- Protected: Accessible within the same package or sub classes
- default: Accessible within the same package
5
Q
What are the types of polymorphism?
A
- Compile Time Polymorphism (mehtod overloading): thesame method name, different type or number of parameters
- Run time polymorphism (method overriding): When a subclasss provides a specific implementation of a metod alread define in its parent or supper class
6
Q
What is an abstact class?
A
It is a class that objects cannot be created from it may contain abstact methods and concreate methods
7
Q
What is an abstract method?
A
It is a method with no body or implementation