Can a class be a super class and a sub-class at the same time? Give example.
If there is a hierarchy of inheritance used, a class can be a super class for another class and a sub-class for another one at the same time.
In the example below, continent class is sub-class of world class and it’s super class of country class.
public class world {
..........
}
public class continenet extends world {
............
}
public class country extends continent {
......................
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Explain importance of inheritance in java?
What is the size of int in 64-bit jvm?
Map map = new HashMap(2); map.add(“1”,”one”); map.add(“2”,”two”); map.add(“3”,”three”); What will happen at this line?
What are the types of sockets in java?
What is assembly language?
What are class types in java?
Explain in detail about encapsulation with an example?
What does snprintf return?
What is the symbol for line break?
Can we sort arraylist in java?
import java.io.*; class Demo { public static void main(String args[]) { File f=new File("1234.msg"); String arr[]=f.list(); System.out.println(arr.length); } }
How do I remove a character from a string in java?