一个成长中的产品经理的点点滴滴,关注技术和产品
测试下CodeHighLighter
暂时用http://www.lastengine.com/syntax-highlighter-wordpress-plugin/
这款吧~~虽然支持样式貌似不多。
wordpress syntaxhighlighter 可以支持我比较习惯的Eclipse的样式。。的说。但是还是这个看着比较习惯貌似。
额。。= =
If a primitive is a field in a class, however, things are a bit different. As you saw in the
Everything Is an Object chapter, each primitive field of a class is guaranteed to get an initial
value. Here’s a program that verifies this, and shows the values:
这个是WP自带的标签
public static void main(String[] args) {
InitialValues iv = new InitialValues();
iv.printInitialValues();
/* You could also say:
new InitialValues().printInitialValues();
*/
}
//: initialization/InitialValues.java
// Shows default initial values.
import static net.mindview.util.Print.*;
public class InitialValues {
boolean t;
char c;
byte b;
short s;
int i;
long l;
float f;
double d;
InitialValues reference;
void printInitialValues() {
print("Data type Initial value");
print("boolean " + t);
print("char [" + c + "]");
print("byte " + b);
print("short " + s);
print("int " + i);
print("long " + l);
print("float " + f);
print("double " + d);
print("reference " + reference);
}
public static void main(String[] args) {
InitialValues iv = new InitialValues();
iv.printInitialValues();
/* You could also say:
new InitialValues().printInitialValues();
*/
}
} /* Output:
Data type Initial value
boolean false
char [ ]
byte 0
short 0
int 0
long 0
float 0.0
double 0.0
reference null
*///:~
You can see that even though the values are not specified, they automatically get initialized
(the char value is a zero, which prints as a space). So at least there’s no threat of working
with uninitialized variables.
When you define an object reference inside a class without initializing it to a new object, that
reference is given a special value of null.
|
| 这篇文章由gstar于2010-02-10 07:52发表在WordPress。你可以订阅RSS 2.0 也可以发表评论或引用到你的网站。 |



