JShellをいじるためにJDK 9アーリーアクセスバージョン172をインストールしてみました。単純なJavaファイルを開いてスニペットとして追加してから実行しようとすると、変更されたクラスTestが表示され、スニペット番号が増加しました。どこが間違っていたのか教えてください。
| Welcome to JShell -- Version 9-ea
| For an introduction type: /help intro
jshell> /open G:\kavitha\Test.java
jshell> /list
1 : public class Test{
public static void main(String[] args){
int i = 1;
int j = 2;
System.out.println("Sum of 1 and 2 is : " + (i+j));
}
}
jshell> /1
public class Test{
public static void main(String[] args){
int i = 1;
int j = 2;
System.out.println("Sum of 1 and 2 is : " + (i+j));
}
}
| modified class Test
jshell> /list
2 : public class Test{
public static void main(String[] args){
int i = 1;
int j = 2;
System.out.println("Sum of 1 and 2 is : " + (i+j));
}
}