我必须检查一个文本文档是否存在,然后我必须替换一个字母,比如 a 到 o。我已经完成了第一部分如何替换字符
class FDExists{
public static void main(String args[]){
File file=new File("trial.java");
boolean exists = file.exists();
if (!exists) {
System.out.println("the file or directory you are searching does not exist : " + exists);
}else{
System.out.println("the file or directory you are searching does exist : " + exists);
}
}
}
Run Code Online (Sandbox Code Playgroud)
这是我做过的
String s=new String("Computer");
if(s=="Computer")
System.out.print("equals A");
if(s.equals("Computer"))
System.out.print("Equal B");
Run Code Online (Sandbox Code Playgroud)
输出是 Equal B
现在为什么 ==不生产equals A
是什么instanceof?
哪些对象,变量变量,临时变量都存储在java中?它们是如何被引用的?我知道方法存储在堆栈中.变量存储堆或堆栈的位置?
在尝试使用文件执行某些操作时,代码就像这样,
File file=new File("aaa.txt");
Run Code Online (Sandbox Code Playgroud)
我在程序中看到的BufferedReader和InputStreamReader也包括在内,你可以用一个简单的例子来解释?我在许多网站上读过有关文件处理的信息,但仍然令人困惑!!!!