0
How to take value from the user in java during compile time
3 Réponses
+ 2
What do you mean by 'during compile time'?
Do you mean during runtime? Then Scanner or BufferedReader.
0
https://code.sololearn.com/c7nAr3R9TDcq/?ref=app
Check out this. It's a program to take user input
- 1
You cannot take user input at compile time. But the user can send arguments during compilation time to main method.
Ex.
javac try.java hi there
class try {
public static void main(String[] args) {
for (int i = 0; i< args.length; i++) {
System.out.print(args[i] + " ");
}
}
}
o/p:- hi there