trying to understand users input, using scanner method | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

trying to understand users input, using scanner method

public class Main { piblic static void main(String[] args) { Scanner str = new Scanner(System.in); System.out.println(Str.nextLine()); } } well, I wanted java to get my input and output in on the screen. wrote this and got this error ./Playground/Main.java:5: error: <identifier> expected piblic static void main(String[] args) { ^ 1 error any ideas? thanks in advance!

30th Mar 2020, 6:59 PM
ArturV
ArturV - avatar
1 Answer
+ 2
Typos `piblic` should be `public`. `Str.nextLine` should be `str.nextLine`. Also import Scanner class. Comapare it with examples in course and you'll understand it.
30th Mar 2020, 7:01 PM
🇮🇳Omkar🕉
🇮🇳Omkar🕉 - avatar