java - 似乎它没有将值传递给参数 [Java]
问题描述
我的代码是这样的。它总是返回 0 或 null;
在我的Encryptor Class
public void encrypt(File src, File dst) throws IOException {
if (!dst.exists()) {
dst.mkdir();
}
if (!dst.isDirectory()) {
return;
}
try {
if (!src.isDirectory()) {
copyEncrypted(src, dst);
} else {
File[] files = src.listFiles();
System.out.println("Encrypting...");
for (File f : files) {
copyEncrypted(f, dst);
if (deleteOriginal) {
f.delete();
}
}
InterfaceController ic = new InterfaceController();
ic.fileList(files.length);
//ic._notif.setText("GAGO");
for (File file : files) {
System.out.println(file);
}
//System.out.println(files.length + " files are encrypted");
}
} catch (IOException e) {
throw e;
}
}
在我InterfaceController Class
用一个方法fileList
和一个 int 参数
private int fileListMain = 0
public void fileList(int List) {
fileListMain = List;
//_notif.setText(fileListMain + " files are encrypted successfully!");
}
就是这样了。每当我运行 Main 并尝试打印文件的大小时。它总是返回 0,当我试图删除 fileListMain 变量的值时,它返回 null。请帮我摆脱这个。提前谢谢你!这是我在stackoverflow中的第一个查询。:)
解决方案
推荐阅读
- wordpress - 如何根据不同的属性名称和范围过滤 woocommerce 产品
- api - Shopware 6 通过 store-api 获取父产品
- python - 用于嵌套字典的 Django 模板中的 For 循环
- angular - 父级的 ngAfterViewInit 与子级的 ngAfterViewInit
- javascript - JavaScript将textarea值复制到剪贴板不起作用
- python - 如何修复 TypeError:+ 不支持的操作数类型:'datetime.time' 和 'datetime.timedelta'
- css - 如何排除 CSS 以影响页面中的滑块?
- python - Flask Scheduler 在视图函数之外运行时失败
- vba - 公式本地 VBA
- python - 使用 lmfit 进行曲线拟合后从拟合统计参数中提取变量