File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes dynamic passing of parameter Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "dynamic passing of parameter" Watch "dynamic passing of parameter" New topic

dynamic passing of parameter

sam sawant

Joined: Mar 26, 2009
Posts: 12
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

Joined: Oct 27, 2005
Posts: 19723

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.

How To Ask Questions How To Answer Questions
sam sawant

Joined: Mar 26, 2009
Posts: 12
if i throw io.exception then it becomes incompatible
where to add that catch? to constructor?
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 39478
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.
wood burning stoves
subject: dynamic passing of parameter