Random Flashcards

1
Q

class ?

A

Collection of objects is called class.

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

object ?

A
  • An Object can be defined as an instance of a class.
    or
  • a real-world entity
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Inheritance ?

A

process of one class acquiring the properties of another classes

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

Polymorphism in Java ?

A

Polymorphism is the ability of an object to take many forms.

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

Abstraction ?

A

hiding the unnecessary details

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

Encapsulation ?

A

Encapsulation in Java is a mechanism to wrap up variables(data) and methods(code) together as a single unit.

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

Why is multiple inheritance not supported in Java?

A

?

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

Can we override the static method?

A

NO.
Static methods cannot be overridden because they are not dispatched on the object instance at runtime. The compiler decides which method gets called.

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

Can we overload the main method?

A

Yes, We can overload the main method in java but JVM only calls the original main method, it will never call our overloaded main method.

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

A Java Constructor returns a value but, what?

A

There are no “return value” statements in the constructor, but the constructor returns the current class instance.

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

Can we overload a static method?

A

Yes. We can overload static methods. But remember that the method signature must be different. For example, consider the following Java program.

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

Constructors?

A
  • It is used to initialize the object.

- It calls a default constructor if there is no constructor available in the class.

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

static vs final?

A
  • static is used to define the class member that can be used independently of any object of the class
  • while final is used to declare a constant variable or a method that cannot be overridden or a class that cannot be inherited.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Multiple inheritance in java?

A

Java does not support Multiple inheritance.

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