MouseMotionListener . ActionListener requires us to implement an actionPer
formed() method that is called whenever an ActionEvent occurs.
-A class can contain variables and methods that are shared among all instances of the
class. These shared members are called static variables and static methods.
-Java, arrays are first-class objects. This means
that an array itself is a type of object
-Synchronization has to do with threads, which we’ll examine
in the next section. For now, all you need to know is that the synchronized keywordindicates that these two methods can never be running at the same time.
-As you might have guessed, threads are created and controlled as Thread objects. An
instance of the java.lang.
-We’ve implemented the Runnable interface in HelloComponent4 .
-The synchronized modifier tells Java to acquire a lock for the object that contains the
method before executing that method.
-Unlike synchronization in other languages, the synchronized keyword in Java provides
locking at the language level. This means there is no way that you can forget to unlock
a class.
-After you install Java 7, the core java runtime command may appear in your path
(available to run) automatically.
-When in doubt, your go-to test for determining which version of the tools you are using
is to use the -version flag on the java and javac commands:
-The Java VM performs all the runtime activities of Java. It loads Java class files, verifies
classes from untrusted sources, and executes the compiled bytecode.
-On
a Unix system (including Mac OS X), you set the CLASSPATH environment variable with
a colon-separated list of directories and class archive files
%export CLASSPATH=/home/vicky/Java/classes:/home/josh/lib/foo.jar:.
-On a Windows system, the CLASSPATH environment variable is set with a semicolon-
separated list of directories and class archive files:
C:\> set CLASSPATH=C:\home\vicky\Java\classes;C:\home\josh\lib\foo.jar;.
-A useful tool to know about is the javap command. With javap, you can print a de‐
scription of a compiled class. You don’t need the source code, and you don’t even need
to know exactly where it is, only that it is in your classpath.
-javac turns Java source code into a compiled class that contains
Java bytecode. By convention, source files are named with a .java extension; the resulting
class files have a .class extension.
-Java Archive (JAR) files are Java’s suitcases. They are the standard and portable way to
pack up all the parts of your Java application into a compact bundle for distribution or
installation.