Bookmark Topic Watch Topic
  • New Topic

compile issue -- with IOException  RSS feed

 
huzain ali
Greenhorn
Posts: 7
Java ME Netbeans IDE Windows
  • Mark post as helpful
  • send pies
  • Report post to moderator
what's wrong with my code??




and i get this error "exception java.io.IOException is never thrown in body of corresponding try statement
catch (IOException ioe)"
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Report post to moderator
why you are catching IOException? you cant catch any checked exception other than java.lang.Exception, with out being thrown from any of methods.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Report post to moderator
Welcome to JavaRanch huzain ali . please use code tag next time, while posting your code. this time i have added them for you.
 
huzain ali
Greenhorn
Posts: 7
Java ME Netbeans IDE Windows
  • Mark post as helpful
  • send pies
  • Report post to moderator
Seetharaman Venkatasamy wrote:Welcome to JavaRanch huzain ali . please use code tag next time, while posting your code. this time i have added them for you.


can you fix my code?
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16059
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Report post to moderator
huzain ali wrote:what's wrong with my code??

That's hard to say, because you're not explaining what the problem is. Does it compile? If not, then what error do you get? Does it run? Does it do something else than you expected? If so, then what did you expect exactly and what is really happening?

I can see a few things that look like they might be a problem:

You're using == to compare objects, for example d==list and (c==List.SELECT_COMMAND)||(c==PlayCommand). Are you sure that that is what you want to do? Because == doesn't check if the contents of objects are the same; it only checks if the references you are comparing refer to the exact same object.

huzain ali wrote:and i get this error "exception java.io.IOException is never thrown in body of corresponding try statement
catch (IOException ioe)"

That error means that the code in the try-block is never going to throw an IOException, so it makes no sense to catch and handle IOException. Remove the try-catch.

When you post a question, please UseAMeaningfulSubjectLine.
 
huzain ali
Greenhorn
Posts: 7
Java ME Netbeans IDE Windows
  • Mark post as helpful
  • send pies
  • Report post to moderator
[Post removed: you already asked this in another topic. Please do not ask the same question more than once.]
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16059
88
Android IntelliJ IDE Java Scala Spring
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!