This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Convert a BufferedReader varaible into an int? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Convert a BufferedReader varaible into an int?" Watch "Convert a BufferedReader varaible into an int?" New topic
Author

Convert a BufferedReader varaible into an int?

Rik Ny
Greenhorn

Joined: Oct 13, 2001
Posts: 13
I would like to know how to convert a BufferedReader varaible into an int for my switch statement?? Here's what i have so far...
public void sendto(BufferedReader response)
{
try
{
int option = response.read();
switch(option)
Manoj Chandran
Greenhorn

Joined: Jan 26, 2001
Posts: 25
Rik,
Your question is not clear.As far as what u asked it is not possible to convert a BufferedReader variable into int bcoz first one is an object and second one is a primitive type and ia not compatible.
But if u want to perform swtich depending on the characters read from the stream the you can safely use the read() method which returns an int representation of the next available character in the stream...
manoj chandran,
Software Engg,SSi


Thanks & Regards,

Manoj Chandran
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Convert a BufferedReader varaible into an int?
 
Similar Threads
Convert "\n" to char '\n'
switch case issue
char value's
Converting user input
cin.getline for java