Go Back   PCMech Forums > Help & Discussion > Web Design / Development

Need Some Help? Type Your Keywords Here:

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Old 02-06-2007, 04:03 PM   #1
Member (7 bit)
 
shaticus's Avatar
 
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
shaticus is offline   Reply With Quote
Old 02-06-2007, 05:08 PM   #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**
AnotherMuggle is offline   Reply With Quote
Old 02-06-2007, 05:40 PM   #3
~ Ryan ~
 
Join Date: Jun 2005
Location: Jackson TN
Posts: 3,516
Send a message via AIM to rspassey Send a message via MSN to rspassey
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!
rspassey is offline   Reply With Quote
Old 02-07-2007, 06:33 AM   #4
Member (7 bit)
 
shaticus's Avatar
 
Join Date: May 2004
Posts: 103
Thank You! That will work perfectly.



Shaticus
shaticus is offline   Reply With Quote
Reply

Bookmarks

Still Need Help? Type Your Keywords Here:


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On


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


All times are GMT -5. The time now is 07:25 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 PL2