Random Tri Flashcards

1
Q

Does java supports multiple inheritance?

A

Java supports multiple inheritance but only through interfaces. That means a class can implement more than one interfaces but can not extend more than one class.

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

What is the difference between constructor and method?

A

Constructor is a special member of a class which is used to create the objects to the class. It is special because it will have same name as class. It will have no return type.

Method is ordinary member of a class which is used to implement some behavior of a class. It will have it’s own name and return type.

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

Can we overload the main() method?

A

Yes, we can overload a main() method. A class can have any number of main() methods. But, one of those must be in the form “public static void main(String[] args)” in order to start the execution.

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