Back
Close

Java教學

IanChang
1,316 views

註解

我們將學習如何寫註解

註解就是對程式碼的解釋

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

單行註解

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

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

測驗

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

測驗
//{...}
//{...}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

多行註解

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

並在結尾後加上*/

多行註解
//{...}
/*
()*/
System.out.println("Java is cool!");
//{...}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

測驗

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

測驗
//{...}
//{...}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.
Go to tech.io
codingame x discord
Join the CodinGame community on Discord to chat about puzzle contributions, challenges, streams, blog articles - all that good stuff!
JOIN US ON DISCORD
Online Participants