madhumathi k

+ Follow
since Nov 01, 2000
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by madhumathi k

main method need not have this exact signature : public static void main

but for the sake of the certification exam just forget what is mentioned in the above sites and remember the signature of the main method given above.
In your example b will pass but a will throw an error saying
"The method declared in class sub cannot override the method of the same signature declared in class parent."
The method in parent and (a) method in sub class are overridden methods but for the above error. Replace long with int in the sub for (a) solves the problem.
Just remember the rules of overloading and overriding :
overloading - The number and type of parameters should be different. Overloading is related in the same class. overloading of methods is providing alternate implementation for the overloaded methods.
overriding - The number and type of parameters and also the return type should be same. overriding is applicable in parent-sub class. overriding feature totally replaces the implementation of the parent class. An overriding method of subclass can only throw THE CHECKED EXCEPTIONS (OR THEIR SUBCLASSES) thrown by the parent class method. But the overriding methods can throws unchecked exception.
Hope this helps!
Thanks I had the same doubt. it got cleared
Continued ...
java.util.EventObject getSource()
java.awt.AWTEvent getID()
Runnable's run()
EventListeners' methods
[] gets precedence over =