¿Cómo ejecutar un archivo Java completo agregado como un fragmento en JShell?
Intenté instalar JDK 9 versión de acceso temprano 172 para jugar con JShell. Cuando intenté abrir un archivo java simple y ejecutarlo después de agregarlo como un fragmento, solo mostró la prueba de clase modificada y aumentó el número de fragmento. ¿Puedes ayudarme a darme cuenta de dónde me equivoqué?
| 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));
}
}