摘要:
Ref: Java 6 Thread States and Life CycleThis is an example of UMLprotocol state machinediagram showingthread statesandthread life cyclefor the Thread... 阅读全文
摘要:
Here is the code: 1 /* 2 Some class,such as a config file,need to be only one.So we need to control the instance. 3 1,private the constructor and crea... 阅读全文
摘要:
Here is the code: 1 /* 2 Instance invocation in the memory: 3 4 */ 5 package kju.obj; 6 7 import static kju.print.Printer.*; 8 public class NonStati... 阅读全文
摘要:
1 /* 2 member variable and static variable: 3 1,invoke ways: 4 member variable,also called 'instance' variable,which can only be invoked by instance.... 阅读全文
摘要:
Ref: Initializing Fields Instance initializers are permitted to refer to the current object via the keywordthis,Ref: Instance Initializers 1 /* 2 I... 阅读全文
摘要:
Access control is often referred to as implementation hiding. Wrapping data and methods within classes in combination with implementation hiding is ... 阅读全文
摘要:
We have to keep in mind that,the 'new' keyword create an array at the runtime rather that at the compile time,that is,at the compile time,jvm just c... 阅读全文
摘要:
1 /* 2 nest for loop demo. 3 Note that,'upside' triangle controls 'inner condition'. 4 */ 5 import kju.print.Print; 6 public class Pyramid { 7 pu... 阅读全文
摘要:
1 /* 2 Difference between 'for' and 'while'. 3 We can transform everything between 'for' and 'while'. 4 if the incremnet is just use for ... 阅读全文
摘要:
具体数值不多,而是符合byte short int char这四种类型,建议使用swtich语句。因为效率稍高。其他情况:对区间判断,对结果为boolean类型判断,使用if,if的使用范围更广。 阅读全文