下列Java语句从指定网址读取html文件,在下划线处应填上的选项是 Reader in = new ___(new URL(urlString).openStream());A.InputStreamReaderB.ReaderC.ByteArrayInputStreamD.DataOutputStream

下列Java语句从指定网址读取html文件,在下划线处应填上的选项是 Reader in = new ___(new URL(urlString).openStream());

A.InputStreamReader

B.Reader

C.ByteArrayInputStream

D.DataOutputStream


参考答案和解析
A 创建一个Reader流的对象in。

相关考题:

下列Java语句从指定网址读取html文件,在下划线处应填上的选项是( )。 Readerin=new______(newURL(urlString).openStream());A.ReaderB.DataOutputStreamC.ByteArraylnputStreamD.InputStreamReader

为使下列代码正常运行,应该在下划线处填入的选项是ObjectInputStream in=new_____(new FileInputStream(“employee . dat”));Employee[]newStaff=(Employee[〕)in.readObject();in .cIose();A.ReaderB.InputStreamC.ObjectInputD.ObjectInputStream

请完成下列Java程序:读取自己的源文件并把它压缩成GZIP文件。注意:请勿改动main()主方法和其他已有语句内容,仅在下划线处填入适当的语句。import java.io.*;import java.util.zip.*;public class exl6 2 {public static void main{String[] arg) {ex16_2 obj16_2 = new ex16_2();obj16_2.doZip("ex16_2.java","ex16_2.gzip")}public void doZip(String strIn,String strOutFileInputStream in;FileOutputStream out;GZIPOutputStream gzip;int nFileLength;byte[] barray = new byte[10];try {in = new FileInputStream(strIn);out = new FileOutputStream(strOut);gzip = new GZIPOutputStream(out);while((nFileLength = in.read(barray, 0 barray.length)) > 0)_____________________;______________________;gzip.close();} catch(Exception e) {e.printStackTrace();}}}

阅读下列 Java 语句ObjectOutputStream outNew ObjectOutputStream {new_______( “ employee.dat ” )};在下划线处,应填的正确选项是A ) FileB ) FileWriterC ) FileOutputStreamD ) OutputStream

请完成下列Java程序。程序的功能是显示用户在命令行方式下指定的任意驱动器文件夹的内容。提示:public string()list();//将文件夹中所有文件名保存在字符数组中返回。注意:请勿改动main()主方法和其他已有的语句内容,仅在下划线处填入适当的语句。源程序文件代码清单如下:import java.io.*;public class FindDirectories{public static void main(String args[]){if(args.length==0)args=new String(){".."};try{______;String[] fileName=pathName.list();for(int i=0;i<fileName.length;i++){File f=new File(pathName.getPath(),fileName[i]);if(______){System.out.println(f.getCanonicalPath());main(new String[]{f.getPath()});}}}catch(IOException e){e.printStackTrace();}}}

下列Java语句从指定网址读取html文件,在下画线处应填上的选项是( )。 Reader in=new (new URL(urlString). openStream);A.ReaderB.DataOutputStreamC.ByteArray InputStreamD.InputStreamReader

请完成下列Java程序:实现打印出自己的源文件的功能。注意:请勿改动main()主方法和其他已有语句内容,仅在下划线处填入适当的语句。import java.io.*;import java.util.StringTokenizer;public class ex27_2{public static void main(String args[])throws IOException{FileInputStream fis=new FileInputStream("ex27_2.java");DataInputStream dis=new DataInputStream(fis);String str=null;while(true){__________________;if(str==null){__________________;}StringTokenizer st=new StringTokenizer(str);while(st.hasMoreTokens()){System.out.print(st.nextToken()+ " " );}System.out.println();}}}

阅读下面Java语句 ObjectOutputStream ut=new ObjectOutputStream(new______("employee.dat"));在下画线处,应填的正确选项是A.FileB.FileWriterC.FileOutputStreamD.OutputStream

在下列程序的划线处应填入的语句是class Person { private int a;}public class Man extends Person{ public int b; public static void main (String arg []){ Person p=new Person(); Man t=new Man(); int i: }}A.i=w;B.i=bC.i=p.a;D.i=t.b;

下面Java语句从指定的网址读取HTML文件,在下画线处应填上的选项是 Reader in=new______(new URL(urlString).openStrream());A.ReaderB.DataOutputStreamC.ByteArrayInputStreamD.InputStreamReader

在程序中,用户输入一个文件名,根据用户输入显示相应文件的信息。注意:请勿修改main()主方法和其他已有语句内容,仅在横线处填入适当语句。______java.io.*;public class basic{public static void main(String[] args){InputStreamReader reader;BufferedReader in;System.out.println("请输入文件名: ");try{reader=new InputStreamReader(______);in=new BufferedReader(reader);String filename=in.readLine();File file=new File(filename);System.out.println("文件名:"+file.______);System.out.println("路径:"+file.getAbsolutePath());System.out.println("大小:"+file.length());}catch(Exception e){e.printStackTrace();}}}

请完成下列Java程序:读取新浪首页文件的数据并且显示出来。要求编写JFrame扩展类,以String类的对象定义的url地址作为入口参数,该类实现根据url参数指定的地址进行连接和读取数据,并且能显示在1个文本区域内。注意:请勿改动main()主方法和其他已有语句内容,仅在下划线处填入适当的语句。程序运行结果如下:import javax.swing.*;import java.awt.*;import java.awt.event.*;import java.net.*;import java.io.*;public class ex25_2 {public static void main(String[] arg) {UrlFrame. page = new UrlFrame("http://www.sina.com.cn");page.show();}}class UrlFrame. extends JFrame. {JTextArea jta = new JmextArea("正在读取文件…");URL url;public UrlFrame(String strAddr) {super (strAddr); //使用父类的构造方法。setSize(450, 300);JScrollPane jsp = new JScrollPane(jta);getContentPane().add(jsp);WindowListener wl = new WindowAdapter() {public void windowClosing(WindowEvent we) {System.exit(0);}};addWindowListener(wl);try {url = new URL(strAddr);____________________;} catch (MalformedURLException murle) {System.out.println("不合适的URL: "+ strAddr);}}void getData(URL url) {URLConnection con = null;InputStreamReader isr;BufferedReader readBuf;String strLine;StringBuffer strBuf = new StringBuffer();try {con = this.url.openConnection();con.connect();jta.setText("打开连接...");isr = new InputStreamReader(con.getInputStream( ));readBuf = new BufferedReader(isr);jta.setText("读取数据...");while ((strLine = readBuf.readLine()) != null)strBuf.append(strLine + "\n");_____________________________;} catch (IOException e) {System.out.println("IO 错误:" + e.getMessage());}}}

请完成下列Java程序。程序的功能是显示用户在命令行方式下指定的任意驱动器目录的内容。(提示:public String[]list();//将目录中所有文件名保存在字符数组中返回)注意:请勿改动main()主方法和其他已有的语句内容,仅在下划线处填入适当的语句。import java.io.*;public class FindDirectories{public static void main(String args[]{if(args.length==0)args=new String[]{".."};try{_______________String[] fileName=pathName.list();for(int i=0;i<fileName.length;i++{File f=new File(pathName.getPath() fileName[i]);if(___________________){System.out.println(f.getCanonicalPath());main(new String[]{f.getPath()});}}}catch(IOException e){e.printStackTrace();}}}

下列Java语句从指定网址读取html文件,在下画线处应填上的选项是( )。A.ReaderB.Data( )utputStreamC.ByteArray InputStreamD.InputStreamReader

阅读下列Java语句:在下画线处,应填的正确选项是( )。A.FileB.FileWriterC.FileOutputStreamD.Outputstream

下列Java语句从指定网址读取html文件,在下画线处应填上的选项是( )。A.ReaderB.Data Output StreamC.Byte Array Input StreamD.Input Stream Reader

阅读下列Java语句: ObjectOutputStream Ut=new ObjectOutputStream(new (employee.datemployee.dat));在下画线处,应填的正确选项是( )。A.FileB.FileWriterC.FileOutputStreamD.Outputstream

有两个文件Java_3.java和Java_3.html,其中Java_3.java是不完整的。请完善程序,并进行调试。请在下画线处填入正确内容,然后删除下画线。请勿删除注释行和其他已有的语句内容。[题目要求]在一个Applet窗口中,显示一个字符串,输出结果如下图所示。Java_3.java文件源程序:import java.awt.*;import javax.swing.*;public class Java_3 (1) JApplet {public void (2) () {Container contentPane=getContentPane();JLabel label=new JLabel("Java的诞生是对传统计算模式的挑战!",SwingConstants.CENTER);contentPane.add( (3) );}}Java_3.html文件源程序:<html><applet code="Java_3.class"width=300 height=50></applet></html>

下列Applet用于显示提供它的主机的IP地址。请选择正确的语句填入横线处。 import java.awt.*; import java. awt. event.*; import java.applet.Applet; import java.net. *; public class ex23 extends Applet { public void init() { setLayout(new GridLayout(2, 1); Button btm = new Button("显示IP"); final Label 1 = new Label(" "); btn. addActionListener (new ActionListener ( ) { public void actionPerformed(ActionEvent ae) { try { URL ur1 = getCodeBase(); String strName = ur1.getHost(); ______ 1.setText (ia.toString()); } catch (Exception e) { e.printStackTrace (); } } }); add (btn); } }A.InetAddress ia = URL.getByName(strName);B.InetAddress ia = InetAddress.getByName(strName);C.InetAddress ia = new InetAddress.getByName(strName);D.InetAddress ia = InetAddress.getByName(ur1);

阅读下列Java语句: ObjectOutputStream Ut=new ObjectOutputStream(new ("employee.dat")); 在下画线处,应填的正确选项是( )。A.FileB.FileWriterC.FileOutputStreamD.Outputstream

阅读厂列Java语句 ObjectOutputStreamout=new ObjectOu中utStream(new______("employee.daf")); 在下划线处,应填的正确选项是( )。A.FileB.FileWriterC.FileOutputStreamD.Outputstream

在J2EE中,URL类代表了统一资源定位器,如果要使用 “http://www.sina.com.cn/index.html”生成URL对象,可以按照如下的()造该对象。 A、URL url=new URL("http","www.sina.com.cn/index.html",80);B、URL url=new URL("http://www.sina.com.cn/index.html");C、URL url=new URL("http","www.sina.com.cn",80,"index.html");D、Url url=new URL("http","www.sina.com.cn/index.html");

关于Applet运行过程,下列说法错误的是()A、浏览器家在指定URL中的HTML文件B、浏览器加密HTML文件C、浏览器加载HTML文件中指定的Applet类D、浏览器中的java运行环境运行该Applet

多选题在J2EE中,URL类代表了统一资源定位器,如果要使用 “http://www.sina.com.cn/index.html”生成URL对象,可以按照如下的()造该对象。AURL url=new URL(http,www.sina.com.cn/index.html,80);BURL url=new URL(http://www.sina.com.cn/index.html);CURL url=new URL(http,www.sina.com.cn,80,index.html);DUrl url=new URL(http,www.sina.com.cn/index.html);

单选题在下列程序的空白处,应填入的正确选项是(  )。import java.io.*;public class ObjectStreamTest{public static void main(string args[])throws IOException{ ObjectOutputStream oos=new ObjectOutputStream(new FileOutputStream("serial.bin")); Java.until.Date d=new Java.until.Date(); oos.______(); ObjectInputStream ois=new ObjectlnputStream(new FileOutputStream("serial.bin")); try{ java.until.date restoredDate=(Java.until.Date)ois.readObject(); System.out.println("read object back from serial.bin file:"+restoredDate); } catch(ClassNotFoundException cnf){ System.out.println("class not found"); }}AreadObjectBWriterCBufferedWriterDwriteObject

单选题阅读下列Java语句:ObjectOutputStream out=new ObjectOutputStream(new ______(employee.dat));在下画线处,应填的正确选项是(  )。AFileBFileWriterCFileOutputStreamDOutputStream

单选题下列Java语句从指定网址读取html文件,在下画线处应填上的选项是(  )。Reader in=new ______(new URL(urlString).openStream());AReaderBDataOutputStreamCByteArrayInputStreamDInputStreamReader

单选题关于Applet运行过程,下列说法错误的是()A浏览器家在指定URL中的HTML文件B浏览器加密HTML文件C浏览器加载HTML文件中指定的Applet类D浏览器中的java运行环境运行该Applet