This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
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 Java SE 8 Programmer I Study Guide this week in the OCAJP 8 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: 20136

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: 44605
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.
I agree. Here's the link:
subject: dynamic passing of parameter
It's not a secret anymore!