+ 1

Hey There Guys Can Any one tell me How to get User Input , This application showing all Output without scanning user input

Hey There Guys Can Any one tell me How to get User Input , This application showing all Output without scanning user input

20th Jul 2021, 2:30 PM
OBITO
OBITO - avatar
2 Respostas
+ 2
Thank you very much guys for your Support All the best Guys for your next Challenges : )
20th Jul 2021, 3:00 PM
OBITO
OBITO - avatar
+ 1
https://code.sololearn.com/cA25A16A5A0A import java.util.*; public class Program { public static void main(String[] args) { System.out.print("Enter your input: "); Scanner scanner = new Scanner(System.in); String text = scanner.nextLine(); System.out.print(text); System.out.println("\nYou entered: " + text); } } ::::INPUT:::: Taco Tuesday! :::OUTPUT::: Enter your input: Taco Tuesday! You entered: Taco Tuesday! ------------------ import java.util.*; ^Put this at the top so you can use the Scanner class. It's how you'll receive input from user. Scanner scanner = new Scanner(System.in); String text = scanner.nextLine(); ^This is where we'll create our scanner object and receive input from the user. We'll store the received input into a String variable called text. The rest of the code is simply displaying the information for the user.
20th Jul 2021, 2:45 PM
Jakko Jak
Jakko Jak - avatar