Content deleted Content added
No edit summary Tags: Mobile edit Mobile web edit |
|||
Line 1:
A '''method''' (or '''message''') in [[object-oriented programming]] (OOP) is a [[Procedure (computer science)|procedure]] associated with an [[class (computer science)|object class]]. An object is made up of behavior and data. Data is represented as properties of the object and behavior as methods. Methods are also the interface an object presents to the outside world. For example a <code>window</code> object would have methods such as <code>open</code> and <code>close</code>. One of the most important capabilities that a method provides is method overriding. The same name (e.g., <code>area</code>) can be used for multiple different kinds of classes. This allows the sending objects to invoke behaviors and to delegate the implementation of those behaviors to the receiving object.Method in java programming sets the behaviour of class object. For example an object can send an <code>area</code> message to another object and the appropriate formula will be invoked whether the receiving object is a <code>rectangle</code>,<code>circle</code>, <code>triangle</code>, etc.
Methods also provide the interface that other classes use to access and modify the data properties of an object. This is known as encapsulation. Encapsulation and overriding are the two primary distinguishing features between methods and procedure calls.<ref>{{cite web|title=What is an Object?|url=http://docs.oracle.com/javase/tutorial/java/concepts/object.html|work=oracle.com|publisher=Oracle Corporation|accessdate=13 December 2013}}</ref>
|