answersLogoWhite

0


Best Answer

a variable holds a single type of literal. i.e. 1, bat, 345. A object is a instance of a class created by the a programmer with a set of methods which preforms certain task depending what methods have been defined.

int a = 4; // a would be the variable

Car b = new Car();// b is an object

b.carGo();// this is an method in the object car created below.

class Car(){

void carGo(){

car moves;

}

}

User Avatar

Wiki User

16y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

11y ago

In Java, functions are called "methods". That means they are defined, not as independent objects, but as part of a class.

A class can contain several methods.

Classes are "templates for objects". That means that objects are defined on the basis of classes. Each object has access to all the public methods in a class.

One difference is that objects are variables, of the specified class type; while methods are really procedures or functions, belonging to a class.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is different between function and object in java?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What are the different between'a' and ''a in java string methods?

The difference between 'a' and "a" anywhere in Java is that 'a' is a primitive char type, while "a" is a String object.


What is the use of object cloning in java?

It allows you to keep the original object untouched. In Java, objects are accessed by reference meaning that when you pass it in a function, anything done to it in the function modifies the original object directly.


Major difference between c and java?

Java is object oriented, C is not...


When constructor function are called in java?

Constructors are called during object creation.


How do you find size of any object in java OR is there any operator or fun.. equivalent size of in c plus plus?

No, there is no such operator or function in Java that can tell you the amount of memory an object uses.


What is the difference between java and object oriented programming?

java is a programming language/platform that embodies object oriented programming concepts. The question of what is the difference is like asking what is the difference between cars and a Volvo.


What is the difference between method and function in java?

A function is a piece of code that can be reused by calling its name while a method is a function that is associated with a class. In Java, functions are usually referred to as static methods.


What is a java object?

A java object is a collection of methods and properties defined in the Java programming language.


Difference between java and C plus plus?

java is an advanced object oriented programming language than c++


What is the function of this in java?

this in java is a keyword that refers to the current object of the class. It is also used in constructor overloading when you want to invoke one constructor from another within the same class.


Can you pass object as an argument to a method?

if you have a function or a method that takes Object as a parameter, you can call that function or method and pass an Object as follows: Let's say you have a class that extends Object and a function as follows public class A extends Object { ..... } void function ( A arg ){ ..... } To call this function, you need an instance of the class A A objectInstance = new A(); function(objectInstance); The next line shows how to pass an instance of the class A to the function.


What is difference between java 2 and java 5?

They are different versions. Java 5 is newer than Java 2. Think of it like the difference between the Playstation 1 and the Playstation 3.