メインファイルを実行した後、いくつかの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!!