Java教學

IanChang
321 views

Open Source Your Knowledge, Become a Contributor

Technology knowledge has to be shared and made accessible for free. Join the movement.

Create Content

註解

我們將學習如何寫註解

註解就是對程式碼的解釋

註解是寫給其他人看的,所以電腦並不會執行

單行註解

單行註解的寫法是在註解開始的地方加入//符號

單行註解
1
6
7
8
//{...}
//
System.out.println("Hello Java"); //
//{...}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

測驗

請你在程式碼裡加入一個寫著我愛Java的註解

測驗
1
6
7
//{...}
//{...}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

多行註解

多行註解則是在開頭前加上/*

並在結尾後加上*/

多行註解
1
6
7
8
9
10
//{...}
/*
()*/
System.out.println("Java is cool!");
//{...}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

測驗

請你在程式碼裡加入多行註解,寫什麼都可以

測驗
1
6
7
//{...}
//{...}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Open Source Your Knowledge: become a Contributor and help others learn. Create New Content