Beruflich Dokumente
Kultur Dokumente
Methods Objects
Attributes Object
references
Movie
• An object is an
instance of a public void displayDetails()
class.
• Objects have public void setRating()
their own
memory. private String title;
• Class definitions
must be loaded private String rating;
to create
instances.
mov1 mov2
title: Gone with the Wind title: Last Action Hero
rating: PG rating: PG-13
j 3 mov1
title: null
rating: null
mov2
Class variables:
• Belong to a class and are common to all instances
of that class
• Are declared as static in class definitions
public class Movie {
private static double minPrice; // class var
private String title, rating; // inst vars
title
rating
minPrice title
rating
title
rating
Movie class variable Movie objects
oe
OrderEntry OrderItem
CLASSPATH
C:\>set CLASSPATH=E:\Curriculum\courses\java\les06
acmevideo acmetools
public
protected
default
private