byte[] fileContent = null;
if (fileContent == null) {
//在此写代码让fileContent 不为null;
} 若fileContent为空,则让fileConten 不为空,请问大家应怎样写?
if (fileContent == null) {
//在此写代码让fileContent 不为null;
} 若fileContent为空,则让fileConten 不为空,请问大家应怎样写?
解决方案 »
- 一个有关继承中自动调用父类无参构造函数的问题
- Servlet下载完成后如何刷新页面?Cannot call sendRedirect() after the response has been commit
- TreeSet(Comparator< ? super E> comparator)
- 如何比较两组数据---在线等
- java中的封装
- 文本读取问题
- Oracle是用Java写的吗?
- 我在网站目录下读取图片在JSP显示,多个图片却只能显示一个图片,请高手相助!
- 偶在JBUILDER里写第一个JAVA程序中遇到的再次报错
- 请问哪里有swt的包和运行环境下载?请提供有效的地址。马上给分!
- 用eclipse编译Azureus源代码的问题
- java与mysql做连接时‘JDBC驱动’的环境变量该怎么配置
需要初始化?fileContent = { 1, 2 };
fileContent[0] = 1;
fileContent[1] = 2;楼主只是想让fileContent不为null就可以了, 最好是fileContent = new byte[0]就行了
fileContent = new byte[0]
还是
fileContent = new byte[1]
?
public static void main(String[] args) {
byte[] t = new byte[0];
System.out.print(t == null);
}
}new byte[1]是一个长度的数组, new byte[0]是零个长度的数组, 它们都不是null.