文档详情

《Java语言程序设计.doc

发布:2017-08-16约1.09万字共15页下载文档
文本预览下载声明
《Java语言程序设计》 重难点 【重点】1.main()方法main()方法可以处于同一源文件中的不同类中;是java执行的入口;Java后面跟的是含有main()方法的类的类名;java根据类名进入不同入口;一个源文件中有多少类就有多少个.class文件 1、每个JAVA应用程序可以包括许多方法,但必须有且只能有一个_ main___方法 2、一个可以独立运行的JAVA应用程序(D ) A.可以有一个或多个main方法 B.最多只能有两个main方法 C.可以有一个或零个main方法 D.只能有一个main方法 3、java程序中,main方法的格式正确的是(D) AB、public void main(String[] args) C、public static void main(String[]s) D、public static void main(String[] args) 4、在类中入口方法main的写法正确的为:(D) A. public static void main(){ } B. public static void main(char c){ } C. public void main(){ } D. public static void main(String args[]){ } 【重点】2.关于访问权限(public , 默认,protected , private). protects B. protected C. protecting D. protect 【重点】3.布局管理器(FlowLayout , BorderLayout , GridLayout)参考课本 1.A、 FlowLayout B、 CardLayout C、 GridLayout D、 BorderLayout 2、在java中下列___A__方法可以把JFrame的布局管理器设为FlowLayout。 A、JFrame.setLayout(new FlowLayout() ); B、JFrame.addLayout(new FlowLayout() ); C、JFrame.setFlowLayout( ); D、JFrame.addFlowLayout( ); 【重点】4.表达式的计算以及各种数据类型的范围(特别是int , float,char) , 了解 强制类型转换 1、在JAVA中语句:37.2%10的运算结果为(A) A、7.2 B、7 C、3 D、0.2 2、public class Test{ public static void main(String[] args){ int a=5; System.out.println( (a%2==1)?(a+1)/2:a/2 ); } }  C __。 A、1  B、2  C、3 D、2.5 3、下面的代码段中,执行之后i和j的值是(D) A. char a=14; B. int a=14; C. int a=14.0f; D. int a=(int)14.0; 整数的范围 【重点】5.字符串常用函数 方法 说明 public String substring(int index) 提取从位置索引开始的字符串部分 public String substring( int beginindex , int endindex) 该子字符串从指定的 beginIndex 处开始,一直到索引 endIndex - 1 处的字符。因此,该子字符串的长度为 endIndex-beginIndex。 “小鱼儿”,应填入的代码是什么? String word = Hello, ; word = word.trim(); String s = word.concat(小鱼儿!); int index1 = s.indexOf(,); int index2 = s.indexOf(!); System.out.println(s.substring(______, _______)); index1+1,index2 2.给定如下Java代码,编译运行后,输出结果是什么? public class EqualsMethod {    public static void main(String[] args) {     Integer n1 = new Integer(47);     Integer n2 = new Integer(47);     System.out.print(n1= =n2)
显示全部
相似文档