#千锋逆战班 Java IO框架

3.(流的分类)对于FileInputStream来说,从方向上来分,它是输入流,从数据单位上分,它是字节流,从功能上分,它是节点流。
4.read方法:
无参的read()方法返回的int类型,是表示数据下一个字节的字节码,如果已经到达流的最后面了,那就返回-1.
read(byte [] bs)方法返回值表示内存空间,参数表示希望读取的字节数
int read(byte b[], int off, int len)方法的返回值就是我们设定的要读取的字节码的长度,off处开始到流数据末端len的字节数了。

5.B
7.

public class Test7 {

	public static void main(String[] args) throws FileNotFoundException {
		
			FileInputStream fin=new FileInputStream("Files\\test.txt");
			try {
				System.out.println(fin.read());
			} catch (IOException e) {
				e.printStackTrace();
			}
	}
}

8.

	public static void main(String[] args) throws IOException {
			FileOutputStream fos=new FileOutputStream("Files\\test.txt");
			String str="helloworld";
			fos.write(str.getBytes());
	
			FileInputStream fin=new FileInputStream("Files\\test.txt");
			byte[] bytes=new byte[10];
			try {
				fin.read(bytes);
			} catch (IOException e) {
				e.printStackTrace();
			}finally {
				fin.close();
			}
			for (int i = 0; i < bytes.length; i++) {
				System.out.print((char)bytes[i]);
			}
	}
}

输出参考:
helloworld

13.I.为了让对象能够被序列化,要求其实现Serializable接口;
II.为了让该对象某个属性不参与序列化,应当使用transient修饰符

16.B

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值