|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
#1 |
|
Member (7 bit)
Join Date: May 2004
Posts: 103
|
Java Input
I am starting to learn java and could use some help. Could anyone tell me how to read input from the keyboard? I need to read a string in from the keyboard but cannot figure out how to accomplish this.
Thanks in advance Shaticus |
|
|
|
|
|
#2 |
|
Member (11 bit)
Join Date: Jul 2006
Location: England - UK
Posts: 1,227
|
Firstly you will need to declare the input buffer, for example:
BufferedReader kbd = null; You will then need to use a variable to read into, for example: String request = kbd.readLine(); which will cause the program to wait for a string to be entered from the keyboard.
__________________
** Custom Desktop: Core i3-530, 4GB Corsair RAM, 500GB WD HDD ** ** Netbook: HP Mini 210, N450, 2GB RAM** |
|
|
|
|
|
#3 |
|
~ Ryan ~
|
import java.util.Scanner;
//declare class Scanner input = new Scanner(System.in); System.out.println("Enter text here: "); String a = input.nextLine();
__________________
RiotCats.com, an internet domain specifically fabricated and visually erected for the appreciation of the feline kingdom! |
|
|
|
|
|
#4 |
|
Member (7 bit)
Join Date: May 2004
Posts: 103
|
Thank You! That will work perfectly.
Shaticus |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| java questions | inflames988 | Web Design / Development | 0 | 09-18-2006 04:42 PM |
| Computer Acronyms | Floppyman | Computer Hardware | 156 | 06-18-2006 06:25 AM |
| Java making my computer freeze | BustaRomeo | Windows Legacy Support (XP and earlier) | 2 | 08-09-2005 07:28 AM |
| Java script works but java applets won't | lexi | Windows Legacy Support (XP and earlier) | 13 | 09-14-2003 07:11 AM |
| Microsoft Wins Stay on Order to Add Java | morriswindgate | General Discussion | 7 | 02-05-2003 09:34 AM |