Differences between Java and C++
-
In C++, you can first define the "header stub" for
a function without implementing the body, which
is given elsewhere.
In Java, you cannot do this (too bad).
-
In C++, you can specify the access type (public, private, etc)
for a whole group of methods and variables
(using the label "public:"). In Java, you must precede
each method or variable with the access type.
-
In C++, each class has a corresponding
destructor method (named with the tilde convention).
In Java, you do not have destructors because of
automatic garbage collection. Still, you may
need to use Java's "finalize" method to dispose
of non-Java resources (e.g., opened files) that your
object may be hogging.