This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

dynamic passing of parameter

 
sam sawant
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i want to pass value of text field of 1 frame to a function which is another java class file

as we did this using constructor,we are geting error io.exception should be thrown or caught
 
Rob Spoor
Sheriff
Pie
Posts: 20510
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Apparently, some statement in the constructor can throw an IOException. As the error says, you must either catch that IOException, or add "throws IOException" to the constructor signature.
 
sam sawant
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if i throw io.exception then it becomes incompatible
where to add that catch? to constructor?
 
Campbell Ritchie
Sheriff
Posts: 48645
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your subject line doesn't tell what the thread is about.

It is difficult to work out where the best place to catch an Exception is, especially since you provided so little detail. But try in the method which calls the constructor. If you have an Exception in the constructor, then you might be best off not creating the object, but declaring the Exception instead.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic