我正在用java开发一个项目,在运行主文件后,一些java文件被更改,如果我在同一执行期间再次运行该文件,输出不会显示java文件中所做的更改
例如有 2 个文件。Main.java 和 file1.java
main.java
public static void main(string[] argv)
{
file1 obj = new file1();
obj.view();
Scanner in = new Scanner(System.in);
String x = in.nextLine();
//before entering any value i manually updated the content of file1.java
obj = new file1();
obj.view();
}
file1.java(更新前)
public class file1
{
public void view()
{
system.out.println("This is test code!!");
}
}
file1.java (更新后)
public class file1
{
public void view()
{
system.out.println("That was done for Testing!!");
}
}
Output :
This is test code!!
This is test code!!