Q1. Why Java classes does not support multiple inheritance?
Ans-: In java child class can not have two or more parent classes. This makes this language simple, easy to use and less complex. However, a class can implement multiple interfaces with the condition that class must override the behavior of interfaces according to its context. James gosling provide this option for implementing polymorphic behavior of the methods according to objects and this concept is similar to as defined in Objective C.
Q2. What is the meaning of following line?
public static void main (String args)
Ans: The above line is the syntax of main method in java. This line is written for JVM, which means to a starting point for it to execute the program.
public is a access specifier which give access of this method to JVM
static it helps JVM to access the method without creating object of this class.
void – method returns nothing
main – keyward
String arg – dynamic string array to store command line argument.
Q3. Can we create two public class file in one notepad file?
Ans- No, we can not create. We can create many java file but the public class file would be only one and the notepad file must be saved with the same name as public class file.