Prepare for your Next Interview
|
Welcome to the Geeks Talk forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
This is a discussion on Overloading within the OOPS forums, part of the Software Development category; Can overloading be done on return type? How?...
|
|||||||
|
|||
|
Re: Overloading
Hi,
It is an accepted fact that Java does not support return-type-based overloading. This means that a class cannot have two methods that differ only by return type -- you can't have int doXyz(int x) and double doXyz(int x) in the same class. And indeed, the Java compiler duly rejects any such attempt In the case of method overloading, Methods cannot be overloaded only on the basis of return type atleast one argument should be different otherwise compiler will give the message The function is already defined in the class . Thanks, Riju. |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Overloading of constructor | amiomi | C and C++ | 2 | 03-20-2009 03:34 PM |
| Operator Overloading | sivasubbu | C# | 5 | 07-26-2008 06:14 PM |
| Overloading Sub Programs. | babi_geek | Oracle | 2 | 06-09-2008 06:17 AM |
| Operator overloading | valireddy | C and C++ | 2 | 04-12-2008 07:34 AM |
| Function overloading example | vicky19772003 | Java | 6 | 05-22-2007 10:43 AM |