This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

user input  RSS feed

 
sagarika chinya
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
I am new to java and i wanted to know if there is a function like scanf which can accept user input?
thanks
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi sagarika,
Welcome to Javaranch, a friendly place for Java greenhorns
In Java, you can retrieve characters typed on the keyboard by invoked the read() method on the System.in input stream.
For instance, the following program allows you to read three integer primitives from the keyboard:
 
William Barnes
Ranch Hand
Posts: 1049
2
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Code samples at sun for reading and writing data
[ October 18, 2002: Message edited by: William Barnes ]
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!