Java Notes-3

-implements the  ActionListener interface in addition to
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. 


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值