Usage on console window | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Usage on console window

Can't we use the console window to write in Java

8th Mar 2019, 12:14 AM
Chiico Brown
Chiico Brown - avatar
4 Answers
+ 1
Try this out System.out.println("Your Message");
8th Mar 2019, 12:31 AM
Dlite
Dlite - avatar
0
You can get user input with the Scanner class: Scanner scan = new Scanner(System.in); This allows you to input text: String text = scan.nextLine(); Now we gonna print out the text you entered: System.out.println("My text: "+text); And you also need to import the java.util package so you can use the Scanner class, so add this line to the top: Import java.util.Scanner;
8th Mar 2019, 12:48 AM
JavaBobbo
JavaBobbo - avatar
0
Hey JavaBobbo Do you know Duke?, As in Duke the Java Mascot?
8th Mar 2019, 12:49 AM
Dlite
Dlite - avatar
0
Hey, yes i know
8th Mar 2019, 12:56 AM
JavaBobbo
JavaBobbo - avatar