i have this code in file Abc.java
and want to run it from another Java program. I tried but it is not taking user input.
public class Abc
public static void main(String args[]) {
Scanner scan = new Scanner(System.in);
int s;
System.out.println("Enter a value..");
s = scan.nextInt();
System.out.println(" "+s);
}
}
which approach I can use to accomplish my task?
You could use something like:
public class Xyz {
public static void main(String args[]) {
Abc.main(args);
}
}