各位大虾:
小弟有一事不明,请大虾指点.JAVA不是没有动态数组的吗
比如写法1肯定不行
File f = new File(str);
long l = f.length();
byte[] b = new byte[l];
FileInputStream fin = new FileInputStream(new File(str));
FileOutputStream fout = new FileOutputStearm(str1);
int num = fin.read(b);
fout.write(b);
可是写法2就可以,(写法2不是违背了JAVA有动态数组的规定吗)
FileInputStream fin = new FileInputStream(new File(str));
FileOutputStream fout = new FileOutputStearm(str1);
byte[] b = new byte[fin.available()];
fin.read(b);
fout.write(b);
小弟有一事不明,请大虾指点.JAVA不是没有动态数组的吗
比如写法1肯定不行
File f = new File(str);
long l = f.length();
byte[] b = new byte[l];
FileInputStream fin = new FileInputStream(new File(str));
FileOutputStream fout = new FileOutputStearm(str1);
int num = fin.read(b);
fout.write(b);
可是写法2就可以,(写法2不是违背了JAVA有动态数组的规定吗)
FileInputStream fin = new FileInputStream(new File(str));
FileOutputStream fout = new FileOutputStearm(str1);
byte[] b = new byte[fin.available()];
fin.read(b);
fout.write(b);
解决方案 »
- native关键字的运用
- 静态上下文不能引用非静态方法 为什么呢 以前这样写就是可以的
- java.lang.Process.exec(cmd)执行linux命令,程序如何与命令行交互?
- 类 Test 是公共的,应在名为 Test.java 的文件中声明 在线等 谢谢
- 二人版的军棋游戏的棋盘用什么数据结构?
- 连接Oracle错误: java.sql.SQLException: Io 异常: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=153092352)(ERR=12505)(ERROR_STACK=
- 关于LOMBOZ的设置问题,我快晕了
- 【求JAVA电子版语法手册】请问各位大哥,哪儿能下到?
- 很奇怪的问题,各位请看!
- 刚学swing,怎样利用MyEclipse中的图形界面工具实现JPanel的切换呢??
- 为什么用double,float,BigDecimal分别来实现2.0-1.9,结果却不同?
- 在WAP客户端能不能执行命令行
JAVA没有静态定义的数组。
int myArray[5];这样定义是错误的。。 JAVA 通过new动态定义数组。。