为什么我的添加不进去元素 空指针异常
public class ByteArrayOutputstream {
public static void main(String[] args) {
ByteArrayOutputstream bos =null;
try {
bos=new ByteArrayOutputstream();
bos.write('a');
bos.write('b');
bos.write('c');
byte[]arr=bos.toArray();
for (int i = 0; i < arr.length; i++) {
System.out.println(arr[i]);
}
} finally {
try {if (bos!=null) {
}
} catch (Exception e) {
e.printStackTrace();
// TODO: handle exception
}
// TODO: handle finally clause
}
}
private void write(char c) {
// TODO Auto-generated method stub
}
private byte[] toArray() {
// TODO Auto-generated method stub
return null;
}
}