0 votes
in JAVA by
How to input string in java?

1 Answer

0 votes
by

How to input string in java?

import java.util.*;  

class Inp

{  

public static void main(String[] args)  

{  

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

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

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

System.out.print(""You have entered: ""+str);             

}  

}  

🔗Reference : stackoverflow.com

🔗Source: Java Interview Questions and Answers

🔗Reference: Javatpoint.com

Related questions

0 votes
asked Oct 10, 2020 in JAVA by Robindeniel
0 votes
asked Oct 24, 2020 in JAVA by sharadyadav1986
...