题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2024-02-16 06:22:55

[单选题]在程序的下划线处应填入的选项是: public class Test_____{   public static void main(String args[]){     Test t = new Test();     Thread tt = new Thread(t);     tt.start();   }   public void run(){     for(int i=0;i<5;i++){       System.out.println("i="+i);     }   } }
A.implements Runnable
B.extends Thread
C.implements Thread
D.extends Runnable

更多"[单选题]在程序的下划线处应填入的选项是: public class "的相关试题:

[单选题]下列程序的功能是将一个整数数组写入二进制文件。在程序的下划线处应填入的选项是: import java.io.*; public class XieShuzu{   public static void main(String[] a){     int [] myArray={10,20,30,40};     try{       DataOutputStream dos=new DataOutputStream(new FileOutputStream("ints.dat"));       for(int i=0;iA.writeArray
B.writeByte
C.writeInt
D.writeDouble
[单选题]在下列代码的下划线处应填入的内容是: public class FirstSample { public static void main(_____ args[]) { System.out.println("你好!"); } }
A.staff
B.double
C.int
D.String
[单选题]下列代码的下划线处应填入的方法名是: import java.applet.*; import java.awt.*; public class Hello extends Applet { public void _____(Graphics g){ g.drawString("How are you!", 10, 10); } }
A.repaint
B.println
C.paint
D.show
[单选题]要得到某目录下的所有文件名,在下列代码的下划线处应填入的内容是(两个下划线的内容相同): _____ pathname = new _____(args[0]); String[] filename = pathname.list();
A.FileInputStream
B.FileOutputStream
C.File
D.RandomAccessFile
[单选题]下列程序的功能是统计字符串中"array"的个数,在程序的空白处应填入的正确选项是: public class FindKeyWords{   public static void main(sring[] 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 inergers, then a[i] is the ith integer in the array.";     int arrayCount =0;     int idex = -1;     String arrarStr ="array";     index = text.indexof(arrayStr);     while(index ______ 0) {       ++arrayCount;       index += arrayStr.length();       index = text.indexof(arrayStr,index);     }     System.out.println("the text contains" + arrayCount + "arrays");   } }
A.<
B.=
C.<=
D.>=
[单选题]在下列程序的空白处,应填入的正确选项是: import java.io.*; public class writeInt{   public static void main(string[] a) {     int[ ] myArray = {10,20,30,40};     try{       DataOutputSystem dos= new DataOutputSystem(new FileOutputSystem("ints.dat"));       for(int i=0;iA.start( )
B.close( )
C.read( )
D.write( )
[单选题]在下列程序的空白处,应填入的正确选项是: import java.io.*; pulilc class ObjectStreamTest{   publilc static void main(string args[]) throws IOException{     ObjectOutputStream oos= new ObjectOutputStream (new FileOutputStream("serial.bin"));     java.util.Date d= new Java.util.Date();     oos. ______ (d);     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 cnf) {       System.out.println ("class not found");     }   } }
A.WriterObject
B.Writer
C.BufferedWriter
D.writeObject
[单选题]下列Java语句从指定网址读取html文件,在下划线处应填上的选项是:   Reader in=new____(new URL(urlString).openStrream());
A.Reader
B.DataOutputStream
C.ByteArrayInputStream
D.InputStreamReader
[单选题]阅读下列程序 public class VariableUse{ public static void main (String[] args) { int a; if (a==8) { int b=9; System.out.println("a = "+a); System.out.println("b = "+b); } System.out.println("a = "+a); System.out.println("b = "+b); } } 该程序在编译时的结果是:
A.变量a未赋值
B.第二个System.out.println(“b = ”+b)语句中,变量b作用域有错
C.第二个System.out.println(“a = ”+a)语句中,变量a作用域有错
D.第一个System.out.println(“b = ”+b)语句中,变量b作用域有错
[单选题] 设有如下程序
Public class test {
Public static void main(String args[]) {
Integer intObj=Integer.valueOf(args[args.length-1]);
Int i = intObj.intValue();
If(args.length > 1)
System.out.println(i);
If(args.length > 0)
System.out.println(i - 1);
Else
System.out.println(i - 2);
}
}
运行程序 , 输入如下命令:
Java test 2
则输出为:
A. test
B. test -1
C. 0
D. 1
E. 2
[单选题]下列程序的输出结果是: public class Test{   public static void main(String[] args){     int [] array={2,4,6,8,10};     int size=6;     int result=-1;     try{       for(int i=0;iA.Catch---1
B.Catch---2
C.Catch---3
D.以上都不对
[单选题] 下列程序运行的结果为:
Public class test {
Public static void main(String args[]) {
Int i;
Float f = 2.3f ;
Double d = 2.7;
I = ((int)Math.ceil(f)) * ((int)Math.round(d));
System.out.println(i);
}
}
A. 4
B. 5
C. 6
D. 6.1
E. 9
[单选题]以下程序的调试结果为?
Public class Outer{
Public String name = "Outer";
Public static void main(String argv[]){
Inner i = new Inner();
I.showName();
}
Private class Inner{
String name =new String("Inner");
Void showName(){
System.out.println(name);
}
}
}
A.输出结果 Outer
B.输出结果 Inner
C.编译错误,因 Inner 类定义为私有访问
D.在创建 Inner 类实例的行出现编译错误
[单选题]为使下列代码正常运行,应该在下划线处填入的选项是:   ObjectInputStream in=new_____(new FileInputStream("employee . dat"));   Employee[] newStaff=(Employee[])in.readObject();   in .cIose();
A.Reader
B.InputStream
C.ObjectInput
D.ObjectInputStream
[单选题]阅读下列程序 public class Test implements Runnable{   private int x=0;   private int y=o;   boolean flag=true;   public static void main(string[ ] args) {     Test r =new Test( );     Thead t1=new Thead(r);     Thead t2=new Thead(r);     t1.start( );     t2.start( );   }   public void run(){     while(flag) {       x++;       y++;       System.out.println("(" +x_ ","+y+")");       if (x>=10)         flag=false;     }   } } 下列对程序运行结果描述的选项中,正确的是:
A.每行的(x,y)中,可能有;每一对(x,y)值都出现两次。
B.每行的(x,y)中,可能有;每一对(x,y)值仅出现一次。
C.每行的(x,y)中,可能有x=y;每一对(x,y)值都出现两次。
D.每行的(x,y)中,可能有x=y;每一对(x,y)值都出现一次。
[单选题]为使下列代码正常运行,应该在下划线处填入的选项是:   abstract class Person{     public Person(String n){       name=n;     }     public____String getDescription();     public String getName(){       return name;     }     private String name;   }
A.static
B.private
C.abstract
D.final
[单选题] 以下程序调试结果为:
Public class Test {
Int m=5;
Public void some(int x) {
M=x;
}
Public static void main(String args []) {
New Demo().some(7);
}
}
Class Demo extends Test {
Int m=8;
Public void some(int x) {
Super.some(x);
System.out.println(m);
}
}
A.5
B. 8
C. 7
D.无任何输出
E.编译错误
[单选题]要向Applet传递参数,应该在下列drawing.html文件的下划线处填入的选项是: …… ______ ……
A.
B.
C.
D.
[单选题]为使下列代码正常运行,应该在下划线处填入的选项是:   int[] numbers=new int[n];   for(int i=0;iA.size
B.length
C.dimension
D.measurement

我来回答:

购买搜题卡查看答案
[会员特权] 开通VIP, 查看 全部题目答案
[会员特权] 享免全部广告特权
推荐91天
¥36.8
¥80元
31天
¥20.8
¥40元
365天
¥88.8
¥188元
请选择支付方式
  • 微信支付
  • 支付宝支付
点击支付即表示同意并接受了《购买须知》
立即支付 系统将自动为您注册账号
请使用微信扫码支付

订单号:

请不要关闭本页面,支付完成后请点击【支付完成】按钮
恭喜您,购买搜题卡成功
重要提示:请拍照或截图保存账号密码!
我要搜题网官网:https://www.woyaosouti.com
我已记住账号密码