Specifications

Sun Services
Java™ Programming Language
Module 3, slide 20 of 37
Copyright 2005 Sun Microsystems, Inc. All Rights Reserved. Sun Services, Revision F
Java Reference Types
In Java technology, beyond primitive types all others
are reference types.
•Areference variable contains a handle to an object.
For example:
1 public class MyDate {
2 private int day = 1;
3 private int month = 1;
4 private int year = 2000;
5 public MyDate(int day, int month, int year) { ... }
6 public String toString() { ... }
7}
1 public class TestMyDate {
2 public static void main(String[] args) {
3 MyDate today = new MyDate(22, 7, 1964);
4 }
5}