This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes overriding and overloading Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "overriding and overloading" Watch "overriding and overloading" New topic
Author

overriding and overloading

amit sanghai
Ranch Hand

Joined: Dec 05, 2000
Posts: 231
I have couple of questions.

1) Can a static method be overriden to be non-static?
2) Can an overloaded method throw an exception which is not checked in the base class?
chi Lin
Ranch Hand

Joined: Aug 24, 2001
Posts: 348
1. No
2. Yes.
Originally posted by amit sanghai:
I have couple of questions.

1) Can a static method be overriden to be non-static?
2) Can an overloaded method throw an exception which is not checked in the base class?


not so smart guy still curious to learn new stuff every now and then
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Rewording your second question:
2) Can an overridden method throw a checked exception which is not checked in the base class?
No.
[ July 26, 2003: Message edited by: Thomas Paul ]

Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Francois Roland
Ranch Hand

Joined: Jul 24, 2003
Posts: 34

Hello,
An overloaded method is just a method with the same name but with different arguments. There is no inheritance here.
Only overriden methods may not throw a checked exception that is not thrown by the corresponding method in the superclass.


--
Brown belt on KnowledgeBlackBelt.com.
 
 
subject: overriding and overloading