yes or no
1.Do I need to import java.langNo, it’s loaded by JVM by default2.Can I have multiple main methods in the same class?No, there can be at most one main method in one class, compiler will report error “main method is already defined in the class”3. Can one import same package/class multiple times?Yes, compiler will not complain. But JVM will only load the class once .4. What is the default value for an object reference?null5.Does importing a package import the subpackages as well?No.e.g. import tkk.netlab.*;   does not import the classes in tkk.netlab.joshua.*;    
6. What if the main method is not defined as public?Compiler no problem. At runtime it will give “main method not public”7.Is empty .java file a valid source file ?yes8. Can a .java file contain more than one java classes?yes. but at most one public class
9. Can an application has multiple classes having main methodyes.10.Is String a primitive data type in Java?no11.Is main a key word?no12.Is next a key word?no13. Is delete a key word?no14.Is exist a key word?no15. Can main() method be declared final?yes, also static,  public static void main(String[] args)16 Does java provides any method to find out the size of an object?no, there is not direct way to determine the size of an object in Java17. Is there length() in array? is there in String?only “int length” variable.  String has length().18. can switch clause be followed by String?No, only integer. So byte, int, short, char are ok.19. Can String be extended?No, final class.20. Can a static method invoke a non-static method?No, it is not guaranteed that the class is instantiated.

解决方案 »

  1.   

    1.Difference between Abstract class and Interface.1) Abstract - a class which has abstract methods, but also instance methods;
      Interface - has only abstract methods.Abstract - a class which may have abstract methods, but must be declared as abstract at the beginning.
      

  2.   

    yes or no
    1.Do I need to import java.langNo, it’s loaded by JVM by default2.Can I have multiple main methods in the same class?No, there can be at most one main method in one class, compiler will report error “main method is already defined in the class”可以重载 
      

  3.   

    7.Is empty .java file a valid source file ?yes
    empty .java 文件名有空格   文件名类名一样,类名不能有空格,所以 这个文件名不对
      

  4.   

    19. argument vs parameterargument 就是变量,方法内的变量
    parameter 是方法的参数这种东西问得太搞笑了,简直在抠字眼!!!