Como executar um arquivo Java inteiro adicionado como um trecho no JShell?
Tentei instalar o JDK 9 Early Access versão 172 para brincar com o JShell. Quando tentei abrir um arquivo java simples e executá-lo após adicioná-lo como um trecho, ele apenas mostrou a classe modificada Test e aumentou o número do trecho. Você pode me ajudar a perceber onde errei?
| 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));
}
}