`
sillycat
  • 浏览: 2486658 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

English-005 Thinking in Java Note

阅读更多
English-005 Thinking in Java Note

1.When the return type is void, then the return keyword is used only to exit the method, and is therefore unnecessary when you reach the end of the method.

2.Whenever you want to use a predefined class in your program, the compiler must know how to locate it.
predefine [ 'pri:di'fain ] v 预先定义

3.To solve this problem, you must eliminate all potential ambiguities.This is accomplished by telling the Java compiler exactly what classes you want by using the import keyword. import tells the compiler to bring in a package, which is a library of classes.
          eliminate              [ i'limineit ] . v 出去
     potential        [ pə'tenʃ(ə)l ] a. 可能的,潜在的
     ambiguity        [ ,æmbi'gju:iti ] n. 不明确,含糊,暧昧,模棱两可

4.Ordinarily, when you create a class you are describing how objects of that class look and how they will behave. You don’t actually get anything until you create an object of that class with new, and at that point data storage is created and methods become available.

5.there are two situations in which this approach is not sufficient.
One is if you want to have only one piece of storage for a particular piece of data, regardless of how many objects are created, or even if no objects are created.
The other is if you need a method that isn’t associated with any particular object of this class. That is, you need a method that you can call even if no objects are created.

sufficient [ sə'fiʃənt ] a. 足够的,充分的

6.When you say something is static, it means that data or method is not tied to any particular object instance of that class. So even if you’ve never created an object of that class you can call a static method or access a piece of static data.

7.At this point, both st1.i and st2.i have the same value of 47 since they refer to the same piece of memory.
class StaticTest {
static int i = 47;
}
StaticTest st1 = new StaticTest();
StaticTest st2 = new StaticTest();

8.At the beginning of each program file, you must place the import statement to bring in any extra classes you’ll need for the code in that file. Note that I say “extra.” That’s because there’s a certain library of classes that are automatically brought into every Java file: java.lang.

9.Thus, in any Java program you write you can say System.out.println("things"); whenever you want to print something to the console.
console     [ kən'səul ] n. 控制台,操纵台

10.in this book we will assume that you are using the Java Developer’s Kit (JDK) from Sun, which is free.
Java Developer’s Kit (JDK)
kit [ kit ] n. 装备,工具箱

11.This command should produce no response. If you get any kind of an error message, it means you haven’t installed the JDK properly and you need to investigate those problems.
investigate [ in'vestigeit ]   v. 调查,研究
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics