string input

Reply

Join Date: Apr 2007
Posts: 1
Reputation: kaluxx is an unknown quantity at this point 
Solved Threads: 0
kaluxx kaluxx is offline Offline
Newbie Poster

string input

 
0
  #1
Apr 14th, 2007
hello we use the class io.*; in our college we use in a unix platform
which is import io*.;
i am trying to code a code so taht i can get a string input i tried ConsoleInput.readString, and also ConsoleInput.readLine()
but still i get an error it says that readString or readLine not found in class io
what can i code
thanks
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 5,264
Reputation: iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold 
Solved Threads: 377
Featured Poster
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Posting Expert

Re: string input

 
0
  #2
Apr 14th, 2007
Why don't you use import java.util.Scanner;
*Voted best profile in the world*
Reply With Quote Quick reply to this message  
Join Date: Jun 2006
Posts: 7,610
Reputation: ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of 
Solved Threads: 464
Super Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Failure as a human

Re: string input

 
0
  #3
Apr 14th, 2007
A small program to get you started:

  1. import java.io.*;
  2.  
  3. public class Test
  4. {
  5. public static void main(String[] args)
  6. {
  7. try
  8. {
  9. BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
  10. String userInput = in.readLine();
  11. System.out.println("\n\nUser entered -> " + userInput);
  12. }
  13. catch(IOException e)
  14. {
  15. System.out.println("IOException has been caught");
  16. }
  17. }
  18. }
I don't accept change; I don't deserve to live.
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 2,357
Reputation: masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of 
Solved Threads: 252
Moderator
masijade's Avatar
masijade masijade is offline Offline
Nearly a Posting Maven

Re: string input

 
0
  #4
Jun 8th, 2009
The same way you're reading the doubles, but without the parsing, of course.
Java Programmer and Sun Systems Administrator

----------------------------------------------

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC