Specifications

Sun Services
Java™ Programming Language
Module 2, slide 8 of 26
Copyright 2005 Sun Microsystems, Inc. All Rights Reserved. Sun Services, Revision F
Declaring Java Technology Classes
Basic syntax of a Java class:
<modifier>*
class
<class_name>
{
<attribute_declaration>*
<constructor_declaration>*
<method_declaration>*
}
Example:
1 public class Vehicle {
2 private double maxLoad;
3 public void setMaxLoad(double value) {
4 maxLoad = value;
5 }
6}