What Is Object In Java? How Many Types Are There And How Can We Create Objects? Please Me Give Clear Examples.

19

19 Answers

Anonymous Profile
Anonymous answered
There are four ways to create an object in Java as follows :
1. Using new operator
2. Using Class.forName()
3. Using clone() method
4. Object de-serialization
Virgo Nadia Profile
Virgo Nadia answered
The Java object is a key to understanding object-oriented technology. The simple definition of an object is a thing which contains information like if you look around right now then you'll find many examples of real-world objects: your dog, your desk, your television set, your bicycle.

Real-world objects share two characteristics: They all have state and behavior. Dogs have state (name, color, breed and hungry) and behavior (barking, fetching, wagging tail). Identifying the state and behavior for real-world objects is a great way to begin thinking in terms of object-oriented programming.

The Software objects are conceptually similar to real-world objects. An object stores its state in fields and exposes its behavior through methods. In Java class is as object, which called by its object.

Bundling code into individual software objects provides a number of benefits, including:
Modularity: The source code for an object can be written and maintained independently of the source code for other objects. Once created, an object can be easily passed around inside the system.

Information-hiding: By interacting only with an object's methods, the details of its internal implementation remain hidden from the outside world.

Code re-use: If an object already exists then you can use that object in your program. This allows specialists to implement/test/debug complex, task-specific objects, which you can then trust to run in your own code.
Senthil Kumaran Gurusamy Profile
An object is a set of data combined with methods for manipulating
that data.
An object is made from a class; a class is the blueprint for
the object.

For creating object one need to follow the below steps

create an object: Name for object :- Syntax: <ClassName> <ClassVariableName>;

instantiation of object: Space in memory for object: Syntax:- <ClassVariableName> = new <ClassName>();

initializing of object: Defining value for object Using constructor: Syntax- <ClassVariableName> = new <ClassName>(initializing value);
Anonymous Profile
Anonymous answered
Still I can't understand correctly what is an object
Anonymous Profile
Anonymous answered
All things are objects which exist in this real world. It has two  characteristics state and behavior.
Variables are state of an object and methods are behavior of an object.

An object is collection of attributes and methods or functions..

An object is an entity that shares two characteristics state and behavior.
Gopinath Sundaram Profile
Object is an instance of a class.It has state,behaviour and identity.There are no types of objects.For the object to be created,the class of the object should be created with needed constructors and then creation of object is done by : Classname objectname = new classname()(depends on which constructor we use).
Anonymous Profile
Anonymous answered
An object is a instance of class. Object can contain some properties and actions properties are represented as variables and actions are represented as methods in java.suppose think that we are going to develop one banking project that's having a Bank class if we create a class with variables and actions that is meaning less without a object here the object is customer. Without customers no bank and vice versa.
Anonymous Profile
Anonymous answered
1) using new
2) Serilaization
3) Shallow cloning
4) Deep cloning same is serialization
5) Reflection/ Class.newInstance()
Anonymous Profile
Anonymous answered
Why can't you guys just give straight forward answer instead of giving examples of a dog..class..house... Lets say this window right here. What is the object inside this window?
Anonymous Profile
Anonymous answered
Objects are key to understanding object-oriented technology. Look around right now and you'll find many examples of real-world objects: Your dog, your desk, your television set, your bicycle.

So at last we can say  object is every thing.
Anonymous Profile
Anonymous answered
Suppose an example of a building.Then the design of a flat or room in that building is class and each flat(room) made by using that design is an object
Anonymous Profile
Anonymous answered
Object is a real world entity which consists set of attributes (i.e. Properties) and set of Actions.  Object is used to store Specific information about an entity.  Object is an entity consists dynamic memory to represent specific data.
Anonymous Profile
Anonymous answered
Object is a created instance of combination of data and function which is exist in class.               By Bachan
Anonymous Profile
Anonymous answered
Objects are the basic runtime entities in an object oriented system. An object takes up space in the memory and has an associated address.
"object=data+methods".
perfect code Profile
perfect code answered
An object is just a cover of class that is created after the class is made to run. Consider a house and different rooms inside the house as methods. Persons living in house as data-members and a small portion of house like garage as constructor....

Here the object of house would be its garden and the gate in the garden through which one can enter and communicate to house (class)

The outside person (variable) can communicate to house(class) only via an object. Object is the mode of communication.

Object oriented is preferred to have the modularity, reuse of code and to have code privacy
Anonymous Profile
Anonymous answered
An Object is a key to understanding object Oriented technology.
.it is  an instance of a class.
It is an entity that shares 2 characteristics state and behavior.
Variables are state of an object.
Methods are behavior of an object.

Answer Question

Anonymous