aspose file tools
The moose likes Beginning Java and the fly likes problem while reading from console Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "problem while reading from console" Watch "problem while reading from console" New topic
Author

problem while reading from console

Sunni srivastav
Greenhorn

Joined: Feb 15, 2011
Posts: 22

Today I was trying to read input from console.I altered the code given in herbert shield's complete reference book but..but was getting error
"Type mismatch: cannot convert from int to String".

bhanu chowdary
Ranch Hand

Joined: Mar 09, 2010
Posts: 256
what is the input you are giving???
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19216

You're assigning the result of Integer.parseInt to String b, not int x. And please UseCodeTags next time.


SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
N Sahni
Ranch Hand

Joined: Jul 07, 2011
Posts: 55

You might also want to check this topic for more information: we-ask-user-input-writing


Thanks and Regards,
Nilesh Sahni | nsahni@infocepts.com | www.infocepts.com
Sunni srivastav
Greenhorn

Joined: Feb 15, 2011
Posts: 22

Rob Spoor wrote:You're assigning the result of Integer.parseInt to String b, not int x. And please UseCodeTags next time.


Thanks Rob.It worked now.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19216

You're welcome.
 
I agree. Here's the link: jrebel
 
subject: problem while reading from console
 
Similar Threads
while loop with an if loop (help)
Why no compiler error?
user input
Beginning applications.........