Sie sind auf Seite 1von 1

instance variables: belongs to a specific instance

Static Variables, Constants and methods

Public: visible to any class in any package


Modefiers

Garbage collection
Private: accessed only by the declaring class

objects cannot access its private members


Accessor methods

System-independent Mutator methods


get- set methods: are used to read and modify private
java.util.Date properties( variables)
Random class
same name as the class itself
Class
play the role of initializing objects
Instance Methods: are invoked by an instance of the
class
do not have a return type—not even void

this keyword Constructors are a special kind of methods that are invoked
Static \ non-static methods
to construct objects
Constructor

by value
is provided automatically only if no constructors are explicitly
defined in the class
MyCircle.radius Default constructor
passing objects to methods
by reference
Accessing Object members invoked using the new operator when an object is created

new Circle()
Immutable objects and classes: it must mark all data
Create objects
fields private and provide no mutator methods and
no accessor methods that would return a reference
Circle myCircle = new Circle(); to a mutable data field object
Declare\ Create object

Circle[] circleArray=new Circle[10];


Array of object: is actually an array of reference
variables

Das könnte Ihnen auch gefallen