题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2023-11-18 21:07:22

[单项选择]

在下列程序的空白处,应填入的正确选项是()
  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. WriterObject

更多"在下列程序的空白处,应填入的正确选项是()   Import java"的相关试题:

[单项选择]下面程序的功能是统计字符串中“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 indMdual 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 index=-1;   String arrayStr="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. >=
[单项选择]

下列程序的功能是统计字符串中“array”的个数,在程序的空白处应填入的正确选项是()
  public class FindKeyWords{
  public static void main(sring[] args){
  sting 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;
  Sting 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. >=
[单项选择]下列程序的功能是统计字符串中“array”的个数,在程序的空白处应填入的正确选项是( )。
public class FindKeyWords
public static void main(sring[]args)
sting 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;
Sting arrarStr="array";
Index=text.indexof(arravStr);
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{    DataoutputStream dos=new DataoutputStream(new FileOutputStream("ints.dat"));    for(int i=0;i<myArray.length;i++)dos.writeInt(myArray[i]);    dos.______;    System.out.println("Have written binary file ints.dat");   }catch(IOException ioe){System.out.println("IO Exception");}  } }
A. start()
B. close()
C. read()
D. write()
[单项选择]在下列程序的空白处,应填入的正确选项是()。
Importjava.io.*;
PulilcclassObjectStreamTest
Publilcstaticvoidmain(string args [])thowsIOException
ObjectOutputStream oos=new ObjectOutputStream
(newFileOutputStream(“serial.bln”));
Java.util.Dated=newJava.util.Date( );
Oos______(d);
ObjectlnputStreamois=
newObjectlnputStream(newFileOutputStream(“serial.bin”));
try
iava.util.daterestoredDate=
(Java.util.Date)ois.readObject( );
System.out.println
(“readobjectbackfromserial.binfile:”
+restoredDate);

Catch(ClassNotFoundException cnf)
System.out.println(“classnotfound”);




A. WriterObject
B. Writer
C. BufferedWriter
D. writerObject
[单项选择]在下列程序的空白处,应填入的正确选项是()。
importjava.io.*;
PublicclasswriteInt
Publicstaticvoidmain(stringl)a)
Int[]myArray=10,20,30,40;
try
DataOutputSystemdos=newDataOutputSystem
(newFileOu中utSystem(“ints.dat”));
for (int i=0;I<MYARRAY.LENGTH:I++)
dos.writeInt(myArray[i];
dos.______";
System.out.println
(“Havewritten binary flleints.dat”);

Catch(IOExceptiOniOe)
System.out.println(“IOException”);





A. start()
B. Close()
C. read()
D. write()
[单项选择]

在下列程序的空白处,应填入的正确选项是()
  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;I  dos。writeInt(myArray[i]);
  dos._____
  System.out.println
  (“Have written binary file ints.dat”);
  }
  Catch(IOException ioe)
  { System.out.println(“IO Exception”);
  }
  }
  }


A. 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. WriterOhject
B. Writer
C. BufferedWriter
D. writerObject
[单项选择]在下列程序的空白处,应填入的正确选项是( )。
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;I<MYARRAY.LENGTH;I++)
dos.writeInt(myArray[i]);
dos.______;
System.out.println
("Have written binary file ints.dat");

Catch(IOException ioe)
System.out.println("IO Exception");



A. start()
B. close()
C. read()
D. write()
[单项选择]下列程序是将一个十进制正整数转化为一个八进制数,在程序的空白处应填入的语句是_______。 #include<stdio.h> main( ) { int i=9,a,b[10]={0}; scanf("%d",&A) ; sub(a,B) ; for(;i>=0;i--)printf("%d",b[i]); } sub(int c,int d[]) { int e,i=0; while(c!=0) {e=c%8; d[i]=e; ________. i++; } return; }
A. c=e/8
B. c=c%8
C. c=c/8
D. c=e%8
[填空题]

下列代码的功能是把按钮save添加到窗口myFrame的中间,在空白处应填入的代码是()。
public class MyFrame
public static void main(String[] args)
JFrame myFrame=new JFrame( );
JButton save=new JButton( );
myFrame.getContentPane( ).add(save,"______");
myFrame.setSize(200, 200);
myFrame.setVisible(true);
 


[填空题]下列代码的功能是把按钮save添加到窗口myFrame的中间,在空白处应填入的代码是______。
import Javax.swing.*;
public calss MyFrame
public static void main(String args[])
JFrame myFrame=new JFrame( );
JButton save=new JButton("Save");
myFrame.getContentPane( )add(save,"______");
myFrame.setSize(200,200);
myFrame.setVisible(true);


[单项选择]下列的程序的功能是求2~100之间的素数,程序中划线部分应填入的选项是   public class Testnn {    public static void main(String args[])     { Labell:      for(int i=2;i<100;i++)       { for(int j=2;j<i;j++)        { if(i%j==______)continue Labell;        }      System.out.println(i);     }    }   }
A. 0
B. 1
C. i
D. j
[单项选择]在程序的下划线处应填入的选项是()。
publicclassTest______
publicstaticvoidmain(Stringargs[])
Testt=newTest( )
Threadtt=newThread(t);
tt.start( );

publicvoidmn( )
for(inti=0;i<5;i++)
System.out.println("i="+i);





A. implementsRunnable
B. extendsThread
C. implementsThread
D. extendsRunnable
[单项选择]在程序的下划线处应填入的选项是( )。
publicclassTest______
publicstaticvoidmain(Stringargs[])
Testt=newTest( )
Threadtt=newThread(t);
tt.start( );

publicvoidmn( )
for(inti=0;i<5;i++)
System.out.println("i="+i);



A. implementsRunnable
B. extendsThread
C. implementsThread
D. extendsRunnable

我来回答:

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

订单号:

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