Because all objects and arrays in Java are accessed through references, assigning the
value of one class-type or array-type variable to another variable copies the reference,
not the contents.
public class Point cfw_
/ Note: a properly written Ja
File I/O allows a Java program to read information from files and save information to
There are two general kinds of file I/O: byte I/O and character I/O.
Byte I/O is useful for reading from and writing to binary files.
Character I/O is us
Like Java, C+ is an object-oriented programming language. However since it is an
extension of C, there are several key differences - most notably:
Rather than requiring separate overloaded constructors, often a single
constructor with default parameters
Currently, our Point class needs setX and setY methods in order to be able to
initialize the x and y fields of newly-created Point objects. We cannot access these
fields directly because we made them private in order to enforce encapsulation.
The key idea in object-oriented programming is that a user defined data type (a class)
has not only member variables but also member functions. "Method" is another term
for member function.
In the code above, when we printed the values of
Java supports many familiar numeric data types and operators that are present in C.
Pretty easy to remember, huh?
Here's a simple program which does
Since data structures are typically designed to hold any type of objects, C+ provides
a mechanism for creating generic classes known as templates. Thus we can qualify
our class with an arbitrary template type and then instantiate an object of the generic
Review of Primitive Java
"Primitive Java" - the subset of Java that is essentially C.
A Java program is a collection of Java classes. A Java class is a user-defined data type,
very much like a C struct type. However, in addition to having fields (member
Kinds of JUnit assertion methods:
assertEquals(expected, actual); / assert that two values (expected
and actual) are equal to each other
assertTrue(value); / assert that a boolean value is true
assertFalse(value); / assert that a boolean value is false
Java arrays are a lot like C/C+ arrays.
The main difference is that Java arrays are objects, in the same way that instances of
classes are objects. As with all objects in Java, instances of array are accessed through
references. Thus, an array