• Post Reply Bookmark Topic Watch Topic
  • New Topic

problem while reading from console  RSS feed

 
Sunni srivastav
Greenhorn
Posts: 24
Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 256
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is the input you are giving???
 
Rob Spoor
Sheriff
Posts: 21131
87
Chrome Eclipse IDE Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're assigning the result of Integer.parseInt to String b, not int x. And please UseCodeTags next time.
 
N Sahni
Ranch Hand
Posts: 55
Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might also want to check this topic for more information: we-ask-user-input-writing
 
Sunni srivastav
Greenhorn
Posts: 24
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 21131
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!