r********r 发帖数: 208 | 1 Just began to learn Thinking in Java, 4th edition. I read the method in the
title among the following code, but failed to find its definition. Anyone
can give me a hint? Thanks in advance.
----on Page 76 of Thinking in Java, 4th edition -------
//: object/ShowProperties.java
public class ShowProperties {
public static void main(String[] args) {
System.getProperties().list(System.out);
System.out.println(System.getProperty("user.name"));
System.out.println(
System.getProperty("java.library.path"));
}
} ///:~ |
r********r 发帖数: 208 | 2 In my Eclipse, the default execution environment is JavaSE-1.6, with the
option of JavaSE-1.7 among drop down menu. Should I switch to 1.7? Is it
better? |
T****U 发帖数: 3344 | 3 system.getproperties() 得到一个properties object.
list(System.out)就把这个object打印到屏幕上面了
http://docs.oracle.com/javase/6/docs/api/java/lang/System.html
http://docs.oracle.com/javase/6/docs/api/java/util/Properties.h
the
【在 r********r 的大作中提到】![](/moin_static193/solenoid/img/up.png) : Just began to learn Thinking in Java, 4th edition. I read the method in the : title among the following code, but failed to find its definition. Anyone : can give me a hint? Thanks in advance. : ----on Page 76 of Thinking in Java, 4th edition ------- : //: object/ShowProperties.java : public class ShowProperties { : public static void main(String[] args) { : System.getProperties().list(System.out); : System.out.println(System.getProperty("user.name")); : System.out.println(
|
T****U 发帖数: 3344 | 4 估计thinking in java 1.6就够了吧。你看看thinking in java用的是什么版本,各版
本之间可能有些区别,不过一般都是compatible的。主要是1.4 to 1.5变化比较大
【在 r********r 的大作中提到】![](/moin_static193/solenoid/img/up.png) : In my Eclipse, the default execution environment is JavaSE-1.6, with the : option of JavaSE-1.7 among drop down menu. Should I switch to 1.7? Is it : better?
|
r********r 发帖数: 208 | 5 Thanks for your explanation. In fact, I have searched and found the
following link is very relevant. Unfortunately, however, it does not include
the definition.
http://docs.oracle.com/javase/1.4.2/docs/api/java/lang/System.h
In general, how can I find the definition of a specific method?
【在 T****U 的大作中提到】![](/moin_static193/solenoid/img/up.png) : system.getproperties() 得到一个properties object. : list(System.out)就把这个object打印到屏幕上面了 : http://docs.oracle.com/javase/6/docs/api/java/lang/System.html : http://docs.oracle.com/javase/6/docs/api/java/util/Properties.h : : the
|
r********r 发帖数: 208 | 6 Thanks, I got it in the 2nd link.
不过,我不明白的是:list( )是Properties的method,不是getProperties()的method
,怎么能有下面的用法呢?
System.getProperties().list(System.out);
【在 T****U 的大作中提到】![](/moin_static193/solenoid/img/up.png) : system.getproperties() 得到一个properties object. : list(System.out)就把这个object打印到屏幕上面了 : http://docs.oracle.com/javase/6/docs/api/java/lang/System.html : http://docs.oracle.com/javase/6/docs/api/java/util/Properties.h : : the
|
T****U 发帖数: 3344 | 7 优先级的问题,省略了一个括号
(System.getProperties()).list(System.out)
其实也算abuse java的一个例子,
ananymous class里面abuse就更严重了
method
【在 r********r 的大作中提到】![](/moin_static193/solenoid/img/up.png) : Thanks, I got it in the 2nd link. : 不过,我不明白的是:list( )是Properties的method,不是getProperties()的method : ,怎么能有下面的用法呢? : System.getProperties().list(System.out);
|
r********r 发帖数: 208 | 8 Do you imply that ObjectReference.member.submember != (ObjectReference.
member).submember? I had thought they are exactly same!
As a beginner, I appreciate your patience. |
g*****g 发帖数: 34805 | 9 这个算不上什么abuse,优先级一直都是从左到右。这个用法很正常,加括号才奇怪。
就如不写(1+2)+3一样。
【在 T****U 的大作中提到】![](/moin_static193/solenoid/img/up.png) : 优先级的问题,省略了一个括号 : (System.getProperties()).list(System.out) : 其实也算abuse java的一个例子, : ananymous class里面abuse就更严重了 : : method
|
T****U 发帖数: 3344 | 10 by "abuse" i mean "易读性差"
【在 g*****g 的大作中提到】![](/moin_static193/solenoid/img/up.png) : 这个算不上什么abuse,优先级一直都是从左到右。这个用法很正常,加括号才奇怪。 : 就如不写(1+2)+3一样。
|
T****U 发帖数: 3344 | 11 in your context, submember belongs to member, not to objectReference(there
is no "submember" concept to a Object). So they are same. Think about it
again.【 在 rearBumper (new ID) 的大作中提到: 】 |
r********r 发帖数: 208 | 12 You are exactly right. I just temporarily fabricated an inappropriate
concept to express my point. Thanks for clarification.
Can I change the "submember" to (member's method)? |