+ 1
Convert the code to make it run on Code Playground
Can anyone help me to make this JAVA code work in Code Playground https://code.sololearn.com/cLJk601rkAae/?ref=app https://code.sololearn.com/cLJk601rkAae/?ref=app
1 Answer
+ 1
import java.util.Scanner;
public class Program
{
public static void main(String[] args) {
new Program().main2();} void main2(){
int n=Integer.parseInt(Example.getText());
// ... rest of your code to } }
} //end of method
} // end of class
class Example {
static String getText() {
Scanner sc = new Scanner(System.in);
System.out.print("enter number: ");
String str = sc.next();
System.out.println(str);
return str;
}
}
class JOptionPane {
static void showMessageDialog(Object t, String str) {
System.out.println(str);
}
}