gpt4 book ai didi

java - toString 需要括号

转载 作者:行者123 更新时间:2023-12-01 18:15:16 25 4
gpt4 key购买 nike

你好,我的代码收到一条错误消息“)预期”

这是我的代码

    @Override
protected void onActivityResult(int requestCode, int resultCode, Intent data){
super.onActivityResult(requestCode, resultCode, data);
if(resultCode==RESULT_OK){
if (requestCode == 1){
File f = new File(Environment.getExternalStorageDirectory().toString()
for (File temp : f.listFiles()){
if (temp.getName().equals("temp.png")){
f = temp;
break;
}
}

最佳答案

代码中有 2 个编译问题,这是一个更正

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if(resultCode==RESULT_OK) {
if (requestCode == 1) {
File f = new File(Environment.getExternalStorageDirectory().toString());
for (File temp : f.listFiles()) {
if (temp.getName().equals("temp.png")){
f = temp;
break;
}
}
}
}
}

问题 1:缺少以下行);

File f = new File(Environment.getExternalStorageDirectory().toString()

问题2:最后你错过了3个大括号}

关于java - toString 需要括号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60381914/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com