JAVA Questions
JAVA Questions
A sub-class is a class which inherits from another class called super class.
Sub-class can access all public and protected methods and fields of its
super class.
1) For Loops
For loops are used in java to execute statements repeatedly for a given
number of times. For loops are used when number of times to execute the
statements is known to programmer.
2) While Loops
3) Do While Loops
Do While Loop is same as While loop with only difference that condition
is checked after execution of block of statements. Hence in case of do
while loop, statements are executed at least once.
A class can implement multiple interfaces but it can extend only one
abstract class.
Use of interfaces also puts an extra burden on the developers as any time
an interface is implemented in a class; developer is forced to implement
each and every method of interface.
Import university.department.*