Computer Science, asked by hemalmeda, 2 months ago

JAVA how to take user input

Answers

Answered by seemamishra5oct
0

Answer:

Example of String Input from user

Explanation:

1. import java.util.*;

2. class UserInputDemo1.

3.{

4.public static void main(String[] args)

5.{

6.Scanner sc= new Scanner(System.in); // System.in is a standard input stream.

7.System.out.print("Enter a string: ");

8.String str= sc.nextLine(); //reads string

Similar questions