File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: overriding and overloading
 
Similar Threads
overloading static methods?
Static method overloading
Shadowing static methods
can a static method be override.
overriding static methods