+ 9

What is the difference between methods and objects in Java?

18th Aug 2017, 3:57 AM
Vaibhav Singh Sikarwar
Vaibhav Singh Sikarwar - avatar
34 Réponses
+ 7
methods are some actions (functions) , they do something. objects just represent some classes or interfaces. according to objects, it's possible to create some links between classes and transfer some parameters.
20th Aug 2017, 5:54 AM
Meshitbayev Yerzhan
Meshitbayev Yerzhan - avatar
+ 17
Consider a class as a skeleton that contains data and methods.You have to use that skeleton to do data manipulation.so you give those skeleton different names called object. through that object you access different types of skeletons.For example a skeleton can be name male or female,both has different characteristics(i.e)data under same attributes. Methods are set of instructions,which we use to do operations on the data. For example, we use Male Object to do a work called writing,then the method write() will have the Following instructions. 1.take pen 2.take paper 3.write "something" this write() method can be accessed by both male amd Female object. to access it with male we use male.write() and to access it with female we use female.write(),where male and female are skeletons objects and write() is a method.
18th Aug 2017, 5:33 AM
geniuS
+ 8
Use the two in a code
18th Aug 2017, 4:42 AM
Manual
Manual - avatar
+ 7
Good question... initialy me too can't discern the difference between objects and methods. there are 3 general things in oop : 1. Classes 2. Methods or sometimes called functions  3. Objects is a class which a blue print for an object. For example: public class CelciustoFahrenheit {     public static void main(String[] args) {     // this is object in classes temperature     temperature obj=new temperature();     ....    } } // this is methods or so called function class temperature {     float CelciustoFahrenheit(float x) {        return  x;    } complete see on my program : https://code.sololearn.com/cx3Kc4gzkSUi/?ref=app
18th Aug 2017, 1:15 PM
A.Darmawan
A.Darmawan - avatar
+ 6
A method is a block of code that can be called by name within the program. An Object is an instance of a class. They may contain methods or attributes that define what they are. Not similar at all.
18th Aug 2017, 4:46 AM
Rrestoring faith
Rrestoring faith - avatar
+ 6
A Class is your idea of something, it's imaginary, think of a car, what's your idea of a car? runs on fuel, 4 wheels, directed using steering wheel, etc. But you can't make use of imaginary car can you? you need a real car to drive and play with, something real, so you need to create/build this idea/imagination into life, a real car. The process of building the real car from the imaginary idea/Class is dubbed "Instantiation" and the real physical car is called "object", it is an instance (reality) of your idea/Class of a car. A method is a block of code you place in a Class' body to allow the Class to perform an action on something, or to process a certain input. In a car for example, a method may be created to allow the driver to start/stop engine, accelerate/decelerate, switch the wipers etc. Other block of code may also be placed in a Class for altering the behavior or appearance of the Class instance (object), they are referred to as Properties or Attributes. They are used to manipulate internal/private data (variables) declared in the Class Properties allow you to get/set current state of the said attribute. e.g. The car Class may have "EngineMode" Property that returns current engine mode, and allows you to change the engine mode (Eco, Sport, Off-Road etc) and it changes how the real car engine behaves. In Java, methods and attributes ownership can be separated into Class' and instance's, a Class' methods & properties can be used directly, without need to create an instance (object). An instance methods & properties requires an instance to be created before invocation. Hth, cmiiw
19th Aug 2017, 9:24 AM
Ipang
+ 4
Methods are actions or codes which perform particular tasks. An object is an instance of the class which have all the properties of that class. for eg, just think the whole police department is a class. the police dept will have certain policies,rules,manners etc. a policeman is an object of that class. all policemen have to obey the same rules and manners which are adopted by the police dept. the methods are the actions taken by the department. it is done by the police man. so,just like that, the methods are invoked using objects.
18th Aug 2017, 5:57 PM
Ardra lakshmi S
+ 4
one object its anything and method its a algorithm
20th Aug 2017, 12:31 PM
José Noel Rosales Pérez
José Noel Rosales Pérez - avatar
+ 3
if you can't find my answer then this is my answer @Eijaz I just want to say that India is unseperable part of India no country including Pakistan and China can separate it with us. And you are saying that the Kashmir parents are dying so it is not the mistake of army it is only the mistake of India .yeah you heard it right it is India's fault that we are letting some fucking separatists (algavadi netas) like Farukh Abdullah and Gilani to live in India They should be locked in a room and should be killed by throwing stones over them. It is the only fault of India :-( :-( just give me your views about my answer
20th Aug 2017, 9:05 AM
Vaibhav Singh Sikarwar
Vaibhav Singh Sikarwar - avatar
+ 3
methods are member functions in Java and objects are used to access those methods
20th Aug 2017, 6:36 PM
Teena M
+ 3
Consider an object like a tool you can get and use, and a method like an annoying operation that you have to do many times. you could use tools in your operations.
20th Aug 2017, 10:10 PM
Stefano Trinca
Stefano Trinca - avatar
+ 3
Thanks @komal for your Care and help
21st Aug 2017, 8:36 AM
Vaibhav Singh Sikarwar
Vaibhav Singh Sikarwar - avatar
+ 2
Objects are divided into two..... Attributes and method. Methods are procedural components while attributes are data components. Methods are used to manipulate the data components of an object
18th Aug 2017, 5:55 PM
Uzoma Collins Arinze
Uzoma Collins Arinze - avatar
+ 2
Basically, Class is a blueprint of Similiar type of Objects, Lets take an example of Human object Arvind. Arvind is a Object of class Human. He has Body parts and Internal Organs as well as he can perform some actions like running , jumping , eating etc. So Parts are the Attribute or Variables of Humans and Methods are The Actions or Functions they can perform. And all Humans including Arvind had both of them.
19th Aug 2017, 8:03 AM
Arvind Singh Rawat
Arvind Singh Rawat - avatar
+ 2
methods are the set of instructions which are executed on an object of a class whereas an object is an instance of a class. method is equivalent to functions in c++
19th Aug 2017, 2:15 PM
supriya s
+ 2
Object is to method as pencil is to writing.... Objects are things. Methods are actions, verbs
20th Aug 2017, 2:50 AM
Gabriela Diaz
Gabriela Diaz - avatar
+ 2
methods and objects both are the different .method is group of institutions and objects are the run time entity of class . by creating object of class we r calling methods
20th Aug 2017, 4:13 AM
komal
+ 2
Thanks to all who gave their nice answers these are really helpful. Now slowly I'm able to understand this topic. Again thanks to all my friends If any body wants any help from me especially in HTML and CSS or wants to talk to me than you can contact me on my email ---- Singhvaibhav924@gmail.com
20th Aug 2017, 8:32 AM
Vaibhav Singh Sikarwar
Vaibhav Singh Sikarwar - avatar
+ 2
and also thanks for your support as this is first time today I saw that this question is in trending section. although it is of no use but than also I'm excited as it is first time in my life
20th Aug 2017, 8:43 AM
Vaibhav Singh Sikarwar
Vaibhav Singh Sikarwar - avatar
+ 2
Hii guys today i was looking on some public question and their a guy has posted a good question and I just want you guys especially Indians to look at my answer and leave your views also as it is a good question. My answer can only Indians can understand. https://www.sololearn.com/discuss/630831/?ref=app
20th Aug 2017, 9:02 AM
Vaibhav Singh Sikarwar
Vaibhav Singh Sikarwar - avatar