preload
May 13
Type Initial Value
boolean false
char ‘\u0000′
byte, short, int, long 0
float, double +0.0
object reference null
Tagged with:
Apr 21
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
private void saveOStoFile(byte[] bs, byte[] imgData, byte[] bs2) {
	OutputStream dos = null;
	File outFile = new File("/sdcard/outFile");
	try {
	  dos = new DataOutputStream(new FileOutputStream(outFile, true));
	} catch (FileNotFoundException e) {
	  // TODO Auto-generated catch block
	  e.printStackTrace();
	}
 
	try {
	  dos.write(bs);
	  dos.write(imgData);
	  dos.write(bs2);
	} catch (IOException e) {
	  // TODO Auto-generated catch block
	  e.printStackTrace();
	}
	try {
	  dos.close();
	} catch (IOException e) {
	  // TODO Auto-generated catch block
	  e.printStackTrace();
	}
 
}
Dec 29

雿甇券 Android 憳 Eclipse 蝚券甇 VIM 嚗

豢嚗雿輻 eclim嚗X Eclipse code-completion VIM 頛撌抒蝺刻摩隞g

鈭銝 eclim 摰蝬拍蝡嚗Insert smart title here (bizkit) – 蝝摮隞/ndroid蝔撘eclimAndroid蝥臬賭誘銵撘瘚蝔 | Windstorm嚗芸楛銋撘憟賭銝潛啣

閰衣冽芸嚗

So Cool!

Tagged with:
Dec 28

汞clipse銝剛霂餈銵launcher皞嚗銝嚗瑕launcher皞 – 瘝瘛銋頝胼androiding – JavaEye舐蝡

汞clipse銝剛霂餈銵launcher皞嚗鈭嚗Eclipse銝剖紡他auncher皞 – 瘝瘛銋頝胼androiding – JavaEye舐蝡

汞clipse銝剛霂餈銵launcher皞嚗銝嚗靽格孵極蝔 – 瘝瘛銋頝胼androiding – JavaEye舐蝡

汞clipse銝剛霂餈銵launcher皞嚗嚗靽格寞蝐颱葉霂珞1 – 瘝瘛銋頝胼androiding – JavaEye舐蝡

汞clipse銝剛霂餈銵launcher皞嚗嚗靽格寞蝐颱葉霂胼2 – 瘝瘛銋頝胼androiding – JavaEye舐蝡

汞clipse銝剛霂餈銵launcher皞嚗鈭嚗餈銵芸楛靽格寧Launcher – 瘝瘛銋頝胼androiding – JavaEye舐蝡


憟質~”~

靘舐湔亦 make Launcher 憟賭

updated: 鈭箸啜湔叮ake sdk嚗嗅游SDK賢占clipse 鋆⊿Ylauncher撠望航炊鈭

Tagged with:
May 21

蝜潭踹瘝蝜潭燙taticSuper嚗隞乩抵敺桀銝

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
class StaticSuper {
	static {
		System.out.println("super static block");
	}
	StaticSuper(){
		System.out.println("super constructor");
	}
}
 
public class StaticTest extends StaticSuper {
	// {
	static int rand;
 
	static {
		rand = (int) (Math.random()*6);
		System.out.println("static block " + rand);
	}
 
	StaticTest(){
		System.out.println("constructor");
	}
 
	public static void main(String[] args) {
		System.out.println("in main");
		StaticTest st = new StaticTest();
	}
}

result:

super static block
static block 5
in main
super constructor
constructor

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
class StaticSuper {
	static {
		System.out.println("super static block");
	}
	StaticSuper(){
		System.out.println("super constructor");
	}
}
 
public class StaticTest {	//閮餉圾 extends StaticSuper
	static int rand;
 
	static {
		rand = (int) (Math.random()*6);
		System.out.println("static block " + rand);
	}
 
	StaticTest(){
		System.out.println("constructor");
	}
 
	public static void main(String[] args) {
		System.out.println("in main");
		StaticTest st = new StaticTest();
	}
}

result:

static block 1
in main
constructor

ref: Head First Java 蝚砍蝡蝺渡憿

May 21

鋆∪芣臬蝷箔祉嗆瑚暻潭見摮嚗銝舀隞賜撘蝣潮賣琿璅嗥嗆鈭閬臭摰閬萄

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*
  comment
*/
 
// Declaring this file to be a package.
// All java source code belongs to some package.
// Only trivial, testing code does not declare a packge.
// When a source file does not declare a package, it is said be a unnamed package
package mary.games.sounds;
 
// load packages you need
import java.awt.Cursor;
import ...
...
 
// a bunch of class definitions
class MyClass1 {
    ...
}
 
class MyClass2 {
    ...
}
 
... // more classes
 
// The main class.
// The file name must be the same as this class name
class MyMainClass {
    public static void main(String[] args) {
        //body...
    }
}

Note嚗嗡葉銝 class 摮閬蝔撘蝣潭詨嚗摮擐摮敹憭批神

ref: Java Tutorial: Printing a String

May 19

瘥撱箸撘蝚砌銵敹 this call嚗 super call嚗嚗交摰 constructor call嚗蝺刻陌冽芸撟思撱箸銝瘝貊 superclass constructor
this() 澆怠銝 class嗡 constructor
super() 澆 superclass constructor

瘥 constructor 臭誑豢澆 super() this()嚗雿銝賢怎具

雿輻 this() 靘敺 constructor 澆怠銝 class 虫 constructor

this() 芾賜典 constructor 銝哨銝敹舐洵銝餈啣乓

super() this() 銝臬澆銋

Head First Java

銝砌隤迎冽貊 constructor 銝剔湔乩蝙 this() 靘澆怠虫貊撱箸寞嚗臭誑撠撖思鈭銴蝔撘蝣潦

Constructor Chain Exercise

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// File   : ConstructorChain.java
// Purpose: Illustrate constructor chaining.
// Author : Fred Swartz
// Date   : 5 May 2003
 
class ConstructorChain {
    public static void main(String[] args) {
        Child c = new Child();
    }
}
 
class Child extends Parent {
    Child() {
        System.out.println("Child() constructor");
    }
}
 
class Parent extends Grandparent {
    Parent() {
        this(25);	//澆怎桀瑟詨貊撱箸摮
        System.out.println("Parent() constructor_CodeFirstLine");
//CodeFirstLine其璅蝷粹摨隞仿皜雿
    }
 
    Parent(int x) {
        System.out.println("Parent(" + x + ") constructor_CodeSecondLine");
//CodeSecondLine其璅蝷粹摨隞仿皜雿
    }
}
 
class Grandparent {
    Grandparent() {
        System.out.println("Grandparent() constructor");
    }
}

瑁蝯嚗
Grandparent() constructor
Parent(25) constructor_SecondLine
Parent() constructor_FirstLine
Child() constructor

Ref1: Java: Constructor Chaining Exercise 1
Ref2: Java thissuper冽 – 銝撽暸帕頧 – BlogJava
Ref3: 撱箸寞嚗Constructor嚗

Tagged with: