Java基础恶补——Development

[SCJP Sun Certified Programmer for Java 6 Study Guide (Exam 310-065)]  chapter10

一. 使用 javac 和 java
1. 使用 javac 命令时,可以用 -d 改变class文件的目的地。

2. The -d option can build package-dependent destination classes on-the-fly if the root package directory already exists.

3. 使用 java 命令时,可以用 -D 来使用系统变量。

4. System properties consist of name=value pairs that must be appended directly behind the -D, for example, java -Dmyproperty=myvalue.

5. 命令行参数总是作为String来看待的。

6. The java command-line argument 1 is put into array element 0, argument 2 is put into element 1, and so on.

 

二. 用 javac 和 java 搜索
1. Both java and javac use the same algorithms to search for classes.

2. Searching begins in the locations that contain the classes that come standard with J2SE.

3. Users can define secondary search locations using classpaths.

4. Default classpaths can be defined by using OS environment variables.

5. A classpath can be declared at the command line, and it overrides the default classpath.

6. A single classpath can define many different search locations.

7. In Unix classpaths, forward slashes (/) are used to separate the directories that make up a path. In Windows, backslashes (\) are used.

8. In Unix, colons (:) are used to separate the paths within a classpath. In Windows, semicolons (;) are used.

9. In a classpath, to specify the current directory as a search location, use a dot (.)

10. In a classpath, once a class is found, searching stops, so the order of locations to search is important.

 

三. 打包和搜索
1. When a class is put into a package, its fully qualified name must be used.

2. An import statement provides an alias to a class's fully qualified name.

3. In order for a class to be located, its fully qualified name must have a tight relationship with the directory structure in which it resides.

4. A classpath can contain both relative and absolute paths.

5. An absolute path starts with a / or a \.

6. Only the final directory in a given path will be searched.

 

四. JAR 文件
1. An entire directory tree structure can be archived in a single JAR file.

2. JAR files can be searched by java and javac.

3. When you include a JAR file in a classpath, you must include not only the directory in which the JAR file is located, but the name of the JAR file too.

4. For testing purposes, you can put JAR files into .../jre/lib/ext, which is somewhere inside the Java directory tree on your machine.

 

五. 静态导入
1. You must start a static import statement like this: import static.

2. You can use static imports to create shortcuts for static members (static variables, constants, and methods) of any class.

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值