java
Java是一个强大的面向对象的编程语言,内部有解释器和编译其相辅相成,能够做到一套代码,多机通用;同时,相比C/C++来说,Java内部有个强大的内存回收机制,提高了程序的健壮性,Java退指针而取引用;Java有丰富的生态和类库,涉及前后端,成为企业开发主力编程语言。
-
下列叙述中正确的是( )。
-
已知:int a[]=new int[100];在下列给出的数组元素中,非法的是( )。
-
下列叙述中,错误的是( )。
-
在switch(expression)语句中,expression的数据类型不能是( )。
-
“++”运算符的操作数个数是( )。
-
在Java中,实现用户界面功能的包是( )。
-
Class类的对象由( )自动生成,隐藏在.class文件中,它在运行时为用户提供信息。
-
在下列程序的空白处,应填入的正确选项是( )。import java.io.*; public class ObjectStreamTest{ public static void main(String[] args)throws IOException{ ObjectOutputStream oos=new ObjectOutputStream(new FileOutputStream("serial.bin")); java.util.Date d=new java.util.Date(); oos.______; ObjectInputStream ois=new ObjectInputStream(new FileOutputStream("serial.bin")); try{ java.util.Date restoredDate=(java.util.Date)ois.readObject(); System.out.println("read object back from serial.bin file:"+restoredDate); }catch(ClassNotFoundException cnfe){ System.out.println("class not found"); } } }
-
Java中类ObjectOutputStream支持对象的写操作,这是一种字节流,它的直接父类是( )。
-
在多线程并发程序设计中,能够给对象X加锁的语句是( )。
-
构造方法名必须与( )相同,它没有返回值,用户不能直接调用它,只能通过new调用。
-
下列程序的功能是统计字符串中“array”的个数,在程序的空白处应填入的正确选项是( )。public class FindKeyWords { public static void main(String[] args) { String text = "An array is a data structur that stores a collection of" +"values of the same type. You access each individual value" +"through an integer index. For example,if a is an array" +"of inegers,then a[i] is the ith integer in the array."; int arrayCount=0; int index=-1; String arrayStr="array"; index=text.indexOf(arrayCount); while(index ______ 0) { ++arrayCount; index+=arrayStr.length(); index=text.indexOf(arrayStr,index); } System.out.println("the text contains"+arrayCount+"arrays"); } }
-
String、StringBuffer都是( )类,都不能被继承。
-
Java中的基本数据类型int在不同的操作系统平台的字长是( )。
-
为使Java程序独立于平台,Java虚拟机把字节码和各个操作系统及硬件( )。
-
阅读下列程序片段:public void test(){ try{ sayHello(); System.out.println("hello"); }catch(ArrayIndexOutOfBoundsException e){ System.out.println("ArrayIndexOutOfBoundsException"); }catch(Exception e){ System.out.println("Exception"); }finally{ System.out.println("finally"); } }如果sayHello()方法正常运行,则test()方法的运行结果将是( )。
-
自定义异常类的父类可以是( )。
-
下列变量名的定义中,符合Java命名约定的是( )。
-
了将HelloApplet(主类名为HelloApplet.class)嵌入在greeting.html文件中,应该在下列greeting.html文件的横线处填入的代码是( )。<HTML> <HEAD> <TITLE>Greetings</TITLE> </HEAD> <BODY> <APPLET ______> </APPLET> </BODY> </HTML>
-
在关闭浏览器时调用,能够彻底终止Applet并释放该Applet所有资源的方法是( )。