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.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.
解决方案 »
- java 创建文件夹的问题
- 我想从键盘中输入一段数字,保存在一个字符数组中,再将里面的数字整体赋值给一个变量下面的程序为何不行啊
- 求题目讲解
- 谁能给我一个完整的GUI示例代码?
- 求大哥或美女给帮个忙?
- 为什么在JPanel中显示不出图片?
- 这条语句是什么意思啊
- 主文件中的中文显示正常,但include进来的文件中的中文产生乱码?在线高分等待!
- J builder5.0中出现neither class nor source found for java.lang.Object
- 告诉我,国内有几个公司在做通用软件,特别是CASE工具!!!!
- eclipse叫人恼火的问题
- 这次尽量说清楚一点,一个JTextfield要怎么做能对应多个标签?
Interface - has only abstract methods.Abstract - a class which may have abstract methods, but must be declared as abstract at the beginning.
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”可以重载
empty .java 文件名有空格 文件名类名一样,类名不能有空格,所以 这个文件名不对
parameter 是方法的参数这种东西问得太搞笑了,简直在抠字眼!!!