Classes and Methods in Java

The language Java has a superficial resemblence to C++, but behind this there are many important semantic differences.

There is no preprocessor in Java, no global variables, no enumerated data types.

Methods are always defined directly in the class definition, instead of having separate interface and implementation forms.

The keywords private and public have much the same meaning, but are applied individually to every data field or method.

The boolean datatype is named boolean, not bool.

All methods must specify a return type.

There are many other differences as well. Some of these we will point out as we proceed through this book.

[audio] [real] Text to accompany slide27, in Chapter 3 of An Introduction to Object-Oriented Programming