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

[填空题]从对象流中读取对象,请在画线处加入代码完成此程序 【10】
import java.util.*;
import java.io.*;
public class UnSerializeDate

Date d = null;
UnSerializeDate( )

try
FileInputStream f = new FileInputStream("data.ser");
______;
d = (Date) s.readObject( );
f.close( );

catch(Exception e)

e.printStackTrace( );


public static void main(String args[ ])

UnSerializeDate a = new UnSerializeDate( );
System.out.println("The date read is :"+a.d.toString( ));


更多"从对象流中读取对象,请在画线处加入代码完成此程序 【10】 。 i"的相关试题:

[填空题]从对象流中读取对象,请在画线处加入代码完成此程序 【10】 。 import java.util.*; import java.io.*; public class UnSerializeDate { Date d = null; UnSerializeDate( ) { try{ FileInputStream f = new FileInputStream("data.ser"); ______; d = (Date) s.readObject( ); f.close( ); } catch(Exception e) { e.printStackTrace( ); } } public static void main(String args[ ]) { UnSerializeDate a = new UnSerializeDate( ); System.out.println("The date read is :"+a.d.toString( )); } }
[填空题]从对象流中读取对象,请在画线处加入代码完成此程序 【10】
import java.util.*;
import java.io.*;
public class UnSerializeDate

Date d = null;
UnSerializeDate( )

try
FileInputStream f = new FileInputStream("data.ser");
______;
d = (Date) s.readObject( );
f.close( );

catch(Exception e)

e.printStackTrace( );


public static void main(String args[ ])

UnSerializeDate a = new UnSerializeDate( );
System.out.println("The date read is :"+a.d.toString( ));


[填空题]从对象流中读取对象,请在下面横线处填写代码完成此程序。 import java.util. *; import java. io. *; public class UnSerializeDate { date d = null; UnSerializeDate ( ) { try { FileInputStream f1 = new FileInputStream("date.ser"); d = (Date) s. readobject ( ); f1,close( ); } catch (Exceptin e) { e. printStackTrace ( ); } } public static main(String args [] ) { System.out.println("The date read is: "+ a.d.toString( )); } }
[填空题]通过实现Runnable接口创建线程,请在画线处加入正确的代码完成此程序 【9】 。 public class ThreadTest { public static void main(String args[ ] { Thread t1 = new Thread(new Hello( ) Thread t2 = new Thread(new Hello( ) ___________; t2.start( ); } } class Hello implements Runnable { int i; public void run( ) { while (true) { System.out.println("Hello"+i++ if(i==5) break; } } }
[填空题]通过实现Runnable接口创建线程,请在画线处加入正确的代码完成此程序 【9】
public class ThreadTest

public static void main(String args[ ]

Thread t1 = new Thread(new Hello( )
Thread t2 = new Thread(new Hello( )
___________;
t2.start( );


class Hello implements Runnable

int i;
public void run( )

while (true)

System.out.println("Hello"+i++
if(i==5) break;



[填空题]通过实现Runnable接口创建线程,请在画线处加入正确的代码完成此程序______。
publicclass ThreadTest

publicstaticvoid main(Stringargs[])

Threadt1=newThread(newHello( )):
Threadt2=newThread(newHellO( ));
T2.start( );


classHelloimplementsRunnable

intI;
publicvoidIUB( )

while(true)

System.out.println(“Hello”+i++);
If(i==5)break;



[填空题]通过实现Runnable接口创建线程,请在画线处加入正确的代码完成此程序______。 publicclass ThreadTest { publicstaticvoid main(Stringargs[]) { Threadt1=newThread(newHello( )): Threadt2=newThread(newHellO( )); T2.start( ); } } classHelloimplementsRunnable { intI; publicvoidIUB( ) { while(true) { System.out.println(“Hello”+i++); If(i==5)break; } } }
[填空题]通过实现Runnable接口创建线程,请在画线处加入正确的代码完成此程序_________。
public class ThreadTest

public static void main(String args[])

Thread t1=new Thread(new Hello( )):
Thread t2=new Thread(new Hello( ));
________;
t2.start( );


class Hello implements Runnable

int i;
public void run( )

while(true)

System.out.println("Hello"+i++);
If(i==5) break:



[填空题]有如下代码片段,请在画线处填入正确的代码,使程序运行正确。 import javax.swing.*; import java.awt.*; import java.event.*; public class JAppletTest extends 【12】 { public void init( ) { Container contentPane = getContentPane( ); Icon icon = new ImageIcon("swing.gif", "A GIF on a swing"); JLabel label = new JLabel("Swing!", icon, Swingconstants. CENTER); contentPane.add(label, BorderLayout. CENTER); } }
[填空题]有如下代码片段,请在画线处填入正确的代码,使程序运行正确。 import javax.swing.*; import java.awt.*; import java.event.*; public class JAppletTest extends 【12】 { public void init( ) { Container contentPane = getContentPane( ); Icon icon = new ImageIcon("swing.gif", "A GIF on a swing"); JLabel label = new JLabel("Swing!", icon, SwingConstants.CENTER); contentPane.add(label, BorderLayout.CENTER); } }
[填空题]下面程序段是从对象流中读取对象,请将程序补充完整。 import java.util.*; import java.io.*; public class UnSerializaDate{ Date d=null; UnSerializaDate( ){ try{ FilelnputStream f=new FilelnputStream("date.ser"); ObjectlnputStream S=new ObjectlnputStream(f); 【13】 f.close( ); } catch(Exception e){ e.printStackTrace( ); } } public static void main(String args[]){ UnSerializaDate a=new UnSerializaDate( ); System.out.println("The date read is:"+a.d.toString( )); } )

我来回答:

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

订单号:

截图扫码使用小程序[完全免费查看答案]
请不要关闭本页面,支付完成后请点击【支付完成】按钮
恭喜您,购买搜题卡成功
重要提示:请拍照或截图保存账号密码!
我要搜题网官网:https://www.woyaosouti.com
我已记住账号密码