2014-02-25

Java 中英文術語對照

control variable - 控制變數
condition - 條件

infinite loop - 無窮迴圈
for loop - for 迴圈
while loop - while 迴圈

expression -  運算式
operand - 運算元
operator - 運算子

declare - 宣告
identifier - 識別字
statement - 陳述
local variable - 區域變數
method invocation - 方法呼叫

class - 類別
field - 屬性
constructor - 建構子
method - 方法
string - 字串

variable - 變數
object - 物件
literal - 字面常數
subclass - 子類別
superclass - 父類別

boolean value - 布林值
integer - 整數
inherit - 繼承
inheritance - 繼承
thread - 執行緒

Java basic data types, objects

資料型態 Data Type (8)

關鍵字 (keyword) ----- 型態類型 (type) ----- 位元數 (bits) ==> Example

byte ----- 整數 ----- (8bits)
short ----- 整數 ----- (16bits)
int ----- 整數 ----- (32bits) ==> int a = 2;
long ----- 整數 ----- (64bits)

float ----- 浮點數 ----- (32bits)
double ----- 浮點數 ----- (64bits) ==> double a = 2.0;
boolean ----- 布林值 ---- (1bit) ==> boolean a = trun;
char ----- 字元 ---- (16bits) ==> char a = '2';


物件 Object (11)

回傳型態 (return types) ---- 名稱 (name) ----- 功能 (feature)

Object ----- o.clone() ----- 複製回傳 o 本身的拷貝
boolean ----- o.equals(Object obj) ------ 判斷 obj 是否與 o 相同
void ------ o.finalize() ----- 呼叫資源回收者檢查此物件是否應該被回收
Class<?> ----- o.getClass() ----- 回傳類別名稱
int ----- o.hashCode() ----- 回傳物件的雜湊碼
void ----- o.notify() ----- 喚醒等待中的單一執行緒 (thread)
void ----- o.notifyAll() ----- 喚醒等待中的所有執行緒
String ----- o.toString() ----- 回傳物件的字串表達形式
void ----- o.wait() ----- 使 o 的執行緒進行等待
void ----- o.wait(long timeout) ----- 使 o 的執行緒進行等待
void ----- o.wait(long timeout, int nanos) ----- 使 o 的執行緒進行等待


2014-02-17

JAVA 的存取修飾元


[修飾元] - [權限]

public - 皆可存取
private - 在相同的 class 才可以存取
default - 在相同的 package 的 class 才可以存取
protected - 在相同的 package 的 class 才可以存取. 不同的 package, 需有繼承關係才可.

2014-02-13

Eclipse Text Searching

Search the text what you would like to show on workspace.

On menu bar, choose Search --> File to open the Search window.


Unassociate File Types in Windows 7

Purpose: 在 Win7 取消特定附檔名被預設程式開啟

Tool filename: Unassoc (v1.4)
Download from here: https://www.dropbox.com/s/z2pxitiru4md5uf/unassoc_1_4.zip
  • This is a green software, do not need to to the installation.
  • Just run "Unassoc.exe", and that operation UI shows up.

  • Select the file type from the list
  • Click " Delete file type ".
  • The user-specific association for the chosen file type is now removed from the registry. The system will now use the global file association settings.


2014-02-12

Eclipse Basically

Establish your first JAVA project within IDE Eclipse.
  • Choose " File --> New --> Java project ".
  • Fill " lu.ide.first " in Project name field.
  • Make sure a option of " Create separate folders for sources and class file "is checked on Project layout.
  • Press " Finish " button to create your first JAVA project.

2014-02-11

Installing RXTX for Serial Communication with Java in MS platform.



01- Get RXTX from here.

  • Filename: rxtx-2.1-7-bins-r2.zip
  • Link: https://www.dropbox.com/s/gt061ayzxe4kaoi/rxtx-2.1-7-bins-r2.zip
02- Unzip that file, then you will see 3 files on following each path.
Path1: rxtx-2.1-7-bins-r2/Windows/i368-mingw32/
  • rxtxParallel.dll 
  • rxtxSerial.dll

Path2: rxtx-2.1-7-bins-r2/
  • RXTXComm.jar
03- Copy there
2 files rxtxParallel.dll & rxtxSerial.dll to [ C:\Program Files\Java\jdk1.7.0_45\jre\bin ]
1 file RXTXComm.jar to [ C:\Program Files\Java\jdk1.7.0_45\jre\lib\ext\ ]



2014-02-06

JAVA Programming Reference from Web


Serial Communication in JAVA with Example Program / Link

Ken Yang 筆記 / Link

Eclipse 簡介與教學 / Link


2013-12-02

JAVA Example - Telnet Client

Required Library: apache.commons.net


========================================

import org.apache.commons.net.telnet.TelnetClient;

import java.io.InputStream;
import java.io.PrintStream;

public class AutomatedTelnetClient {
    private TelnetClient telnet = new TelnetClient();
    private InputStream in;
    private PrintStream out;
    private String prompt = "%";

Java - Input library of "apache.commons.net" to IDE Eclipse.

1-
由下面連結下載 "commons-net-3.3-bin.zip".
http://commons.apache.org/proper/commons-net/download_net.cgi

2-
解壓縮 commons-net-3.3-bin.zip

3-
Execute Eclipse --> create a new java project

4-
Left click on project --> Build Path --> Configure Build Path...
On Libraries tab --> Add External JARs...
Browse a file "commons-net-3.3.jar" where you put on.



5-
A Library "commons-net-3.3.jar" should listed on left side Project Explorer.