Study of Java

Our reference here is the Java Language Specification, 3rd Edition. Part of the goal of this lecture is for you to gain expertise in "spec reading". Some of the examples below are taken from the Java spec.

Classes and Inheritance

We either have or can easily encode in STFbOB nearly all of the features of basic Java class declarations and inheritance.

Java Public/Private/package protected/Protected and Caml Modules

Constructors

Subtyping

Inner Classes

Lets start with reviewing what FbOB had in this area: Java inner classes give some but not all of the above FbOB functionality. Inner classes / FbOB object declarations vs the higher-order functions of Caml etc: Terminology aside: closure

Generics

(other links: their use in classes; an overview)

Generics are Java's version of parametric types. These notes assume familiarity with them; read a tutorial if you are not.

The PEFb language includes both type inference and polymorphism so it is the only language we studied with polymorphism. The main idea of how generic types are handled are expressed there, but in an inference context.

Here are some comparisons with the PEFb or Caml-style parametric types that we studied:

Bounded subtyping

To get around this weakness, Java 5 adds bounded subtyping

Method Overloading

The take-home message here is brief:

Immutable Data

One of the key lessons of Caml is the importance of known immutable data: it has universal meaning.

Concurrency

The book chapter on concurrency reviews the Java concurrency model.

Other issues of comparison between Java and Caml / Fb family of languages

Some advanced dimensions of Java we did not really study at all