国开学习网《面向对象程序设计》形考任务4答案

国开学习网《面向对象程序设计》形考任务4答案 | 零号床
国开学习网《面向对象程序设计》形考任务4答案
此内容为付费阅读,请付费后查看
3
限时特惠
立即购买
购买后刷新当前页面。不显示可以保存订单号联系客服
付费阅读
已售 148

下面()既可以作为流的数据源,又可以作为流的目的地。
进行文件输入输出操作时,最常用的系统包是()。
Java中有3个标准输入/输出流,下面的()不包含在内。
在读字符文件Employee.dat时,使用该文件作为参数的类是()。
下列不是InputStream子类的是()。
下列哪个类不是异常类的父类?()。
下面的关键字()与异常处理无关。
下面的异常()为数组下标越界异常。
下面()既可以作为流的数据源,又可以作为流的目的地。
Java中有3个标准输入/输出流,下面的()不包含在内。
在Java中将信息的输入与输出过程抽象为输入/输出流。输入是指数据流入程序,输出是指数据从程序流出。
向文本文件中写入字符数据,在任何时候都只需要用到文件写入器类(FileWriter),不需要用到缓冲写入器类(BufferedWriter)。
FileWriter和FileWriter类的构造函数的参数都需要一个文本文件名。
在对文件进行的输入/输出(I/O)方法的调用中,当遇到错误时通常会抛出一个IOException异常。
当一个方法进行文件访问操作可能生成一个IOException异常时,该方法必须在方法头声明抛出该异常,别无其他选择。
输入流类(InputStream)和输出流类(OutputStream)是用来处理字节流的抽象基类。
Java.io包中的OutputStream及其子类专门用于把字节数据写入二进制数据文件中。
文件输出流类(FileOutputStream)和数据输出流类(DataOutputStream)不是OutputStream类的子类。
DataOutputStream类的文件流能够把各种基本类型的数据写入到二进制数据文件中。
java.io包中提供的ObjectOutputStream类能够把对象信息存储到文件中。
"public class XXK2 {\n
private final int a;\n
public XXK2(int a) {this.a=a;}\n
public int f1(int x) {\n
if(x%2==1) return 2*(a+x);\n
else return 3*a+x;\n
}\n
public int get() {return a;}\n
public static void main(String[] args) {\n
XXK2 x=new XXK2(8);\n
int y=x.f1(20);\n
y+=x.get();\n
System.out.println(""y=""+y);\n
}\n
}"
"public class XXK2 {\n
private int a; public XXK2(int aa) {a=aa;}\n
public int f1(int x) {\n
if(x%2==1) return 2*(a+x);\n
else return 3*a+x;\n
}\n
public int get() {return a;}\n
public static void main(String[] args) {\n
XXK2 x=new XXK2(5);\n
int y=x.f1(9);\n
y+=x.get()*x.get();\n
System.out.println(""y=""+y);\n
}\n
}"
"public class XXK2 {\n
private int a;\n
public XXK2() {a=3;}\n
public XXK2(int aa) {a=aa;}\n
public double f1() {\n
return 2*Math.pow(a,3)+a;\n
}\n
public static void main(String[] args) {\n
XXK2 x=new XXK2(), y=new XXK2(5);\n
System.out.println(x.f1()+"", ""+y.f1());\n
}\n
}"
"class Rectangle {\n
private int a,b;\n
public Rectangle(int aa, int bb) {a=aa; b=bb;} p\n
ublic int area() {return a*b;}\n
public int girth() {return 2*(a+b);}\n
}\n
public class XXK3 extends Rectangle {\n
private int c;\n
public XXK3(int aa, int bb, int cc) {super(aa,bb); c=cc;}\n
public int volume() {return area()*c;}\n
public int arrisLength() {return 2*girth()+4*c;}\n
public static void main(String[] args) {\n
XXK3 x=new XXK3(2,3,4);\n
int y1=x.volume();\n
int y2=x.arrisLength();\n
System.out.println(y1+"", ""+y2);\n
}\n
}"
"public class SetTest {\n
public static void main(String[] args) {\n
HashSet hs = new HashSet();\n
boolean b1 = hs.add(""a"");\n
hs.add(""b"");\n
hs.add(""c"");\n
hs.add(""d"");\n
hs.add(""d"");\n
boolean b2 = hs.add(""a"");\n
System.out.println(""size=""+hs.size());\n
}\n
}"

© 版权声明
THE END
喜欢就支持一下吧
点赞15 分享