What is an Object?

A Java 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.

Each object made from a class will have its own values for the instance variables of that class. Instance variables are things an object knows about itself.

Things an object can do are called methods.

Creating Objects

The three steps to creating a Java object are:

Object Declaration

Declaring an object associates a variable name with an object.

Object Instantiation

Instantiating an object allocated space in memory for the object. This is accomplished with the new operator.

Object Initialization

Initializing an object fills the objects varibles with an initial set of values. This is accomplished using a constructor.

Example Object Creation

This example creates a Java object named address from the class URL and initializes it with the value http://www.java-faq.com:

URL address = new URL("http://www.java-faq.com");


Top 5 Free Networking Tools

Bookmark What is an Object?

Latest Blog Posts


English English GermanGerman SpanishSpanish FrenchFrench ItalianItalian PortuguesePortuguese RussianRussian DutchDutch
GreekGreek HindiHindi JapaneseJapanese KoreanKorean ChineseChinese Chinese (Simplified)Chinese (Simplified) ArabicArabic

Copyright 2009 Tech-FAQ. All rights reserved. Privacy Policy.