This content has been marked as final. Show 2 replies
Hello Java Community,Hi
In dynamic biniding consept, it binds theBasically, there are two things Class and object.
appropriate method at run time... can any one
please give me the reason how it identifes that
perticular method is nearst one.....( i know that it
first check sub class and then goes to super class
....... i just want how it identifys this
Class defines a particular structure.
And Object is a real instance of that structure.
Now Objects are stored in a Heap. You need a reference to access them.
Now the variable that refer to that object could be of the same structure or any Parent of that structure.
Now object is responsible for doing something(changing state, or performing some action), not the structure through which you refer to it.
I think things would be clear now.
As per java soft new release JDK1.5 weThis was possible in earlier versions as well.
can also write abstract class with out implimenting
methods(even partially also) ...
in this case if iThe difference would be in your stategy.
declare all methods in abstract class were "public
abstract " (like in interface methods return type)
it will be similar as interface ......... and i
just want in this case what is the difference
between interface and abstrace class
If you foresee, that you could have to give default implementation to the methods later, then this option is open for you in Abstract class.
Also you could define constructors in an abstract class.
Otherwise it would better to implement an interface, as the option of extending another class would be open for you.
But I think Interfaces are better for defining raw structure of an application, because defining a structure is a managerial issue, and implementing that structure is a technical issue. Those two shouldn't be intermixed.
But as I said earlier it depends on you requirements, which way to go.