2011/10/28 Francisco Dalla Rosa soares <soa...@argo.bz>:
> http://lmgtfy.com/?q=java+override
> I can't of nicer way to do this :)
>
>
> 2011/10/28 JBlaza <jbl...@gmail.com>
>>
>> I have looked on several other forums. i am new to the java programming
>> community, and i am looking for a clear understanding of the @overide
>> annotation, and what it does, or signifies.
>>

The override part is a comment.  It means that the routine exists
already in your class or parent(s) class and that you have decided to
do it differently from the already implemented code.
In other words, you have created a new class derived from an existing
class.  The existing class or one of its parent classes has
implemented a function.  You want to change the  behaviour of
that funciton so you override it by creating the same function in your class.

Possibly I am not sure, but the keyword might also check your function
parameters and return class to ensure that
you are correctly matching the existing function as a check. Said
another way, there exists a class called Foo and you derive from it
with a class called MyFoo.  Foo implements
a routine called void doIt(int a);  You want to override it.  In
eclipse, you type doI - and then ctrl-space and it auto-completes to
the function signature with empty brackets and the @override keyword.
Somewhere along the way, you change the funciton parameter to a float,
but you leave the @override keyword there.  As far as the compiler
goes, this is legal, but with the override syntax there
the compiler will flag that the routine is not really overriden since
doIt() requires a int parameter and not a float.

-- 
John F. Davis

独树一帜

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to