0
Can we ask the user to enter the value without using any class Or importing. It does not work for some reason in this app java
Public static void sum(int a, int b)
4 ответов
+ 1
Yeah we can do it
+ 1
public class Program
{
public static void main(String[] args) {
java.util.Scanner readin = new java.util.Scanner(System.in);
String readinn = readin.nextLine();
System.out.printf("%s",readinn);
}
}
+ 1
Anshul Kalmegh let check it
0
You cannot run a java program without a class and a main method.
But you can pass arguments from command line to the main() and then convert those entries to a desired type and perform the required operations.