aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Handling NoSuchMethodError Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Handling NoSuchMethodError" Watch "Handling NoSuchMethodError" New topic
Author

Handling NoSuchMethodError

Moguluri Ravi Kiran
Ranch Hand

Joined: Apr 16, 2010
Posts: 62

Hello & hi to each & every JavaRancher






is there any way to handle the Exception Caused here.

Thanks & Regards..

[Devaka: Added a meaningful subject line]
Devaka Cooray
ExamLab Creator
Saloon Keeper

Joined: Jul 29, 2008
Posts: 3220
    
  49

Moguluri Ravi Kiran wrote:is there any way to handle the Exception Caused here.

No - and you should NOT.


Author of ExamLab ExamLab - a free SCJP / OCPJP exam simulator
What would SCJP exam questions look like? -- Home -- Twitter -- How to Ask a Question
Moguluri Ravi Kiran
Ranch Hand

Joined: Apr 16, 2010
Posts: 62

Dear Devaka Cooray

you said "There is no way"
& "WE SHOULD NOT"..

may i know ,why you said "we should not"..
is there any significant reason for that..
Ireneusz Kordal
Ranch Hand

Joined: Jun 21, 2008
Posts: 423
Moguluri Ravi Kiran wrote:Dear Devaka Cooray

you said "There is no way"
& "WE SHOULD NOT"..

may i know ,why you said "we should not"..
is there any significant reason for that..

Because you try to instantiate a class from inside a static initializer block of this class.
This class is not initialized yet- it's not ready to be used.
This is like when your car is repaired in a garage, it is now without tires and oil, but you try to fire an engine and drive to home
- no way, it's impossible.
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6662
    
    5

A java application client program needs a main method to start its execution from. Your program does not have this.

Also, errors should never be handled, although you can handle them by catching them.An error is meant to specify that your program execution cannot continue for any reason.


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Handling NoSuchMethodError