引言 introduction
來了這個平台已經好幾天,看見很多不同的文章,當中包括旅遊、家庭分享、美食、加密貨幣和程序編寫等。集中在程序編寫的文章,我發現有很多都是技術文,需要有一定程序編寫的根基才能看得懂。所以,我就心血來潮想寫一系列的基礎教學,教導一些基本編程知識,好讓一些完全不懂編程和編程根基較薄弱的網友增進一下有關程序編寫知識。事不宜遲,馬上開始。還有,我的英語能力不是很好,如有任何錯誤,歡迎指正。
I have stay in this platform several days. I saw many various article, including travel ,family share , food, cryptocurrency and programming. Focus on the article of the programming, I discovered many article are the technical article. If the reader want to understand it, the need to have the basic of the programming. So, I hope that I can edit the tutorials of the programming. Teaching the basic knowledge of programming.Let's start! Also, my english do not good. If this tutorials have any mistake, please correct it and say with me.
首先,這個課程將會專注於Java的語法編寫。至於如何設定開發環境等的教程這裏將不會提及,各位可在google自行去爬文。如果覺得整合開發環境的設定過於複雜而且短時間內不可能設定好的話,我推介一個線上代碼調試的網站,好讓各位能即時測試自己所學。
First, this tutorials will focus on the grammar of the Java. I will not mention how to set up the development environment. You can search in the Google. If you consider that set up the integrated development environment are difficult and waste times, I can recommend the online code editor for you. Let you can test your learning achievement in real time.
Java程序的結構 The structure of Java programming
public class Test{
public static void main(String arg[]){
}
}
Java是一個物件導向式的程序語言,所以要建基於類別(Class)内。
Java is the object-oriented programming language, so it need to build up in the Class.
我的第一個程式-你好世界程式 My first program - Hello World program
接下來我將會教授如何讓程序顯示字句
Next, I will teach you how to let program show the text
System.out.println("Hello World !");
這是用來顯示文本的語法,括號內的字句是可修改的,如
This code can show the text in the program. The text in the parentheses can mortify it.
主要程序 Main Program
public class test{
public static void main(String arg[]){
System.out.println("Hello World");
}
}
結果 Result: Hello World !
如果你成功了,恭喜你。如果你不成功,看看你是否犯下了以下錯誤。
If you success, congratulation. If you do not success, below have the common mistake that are you make it?
1.沒有大寫 No capital letter
Java對大小寫敏感,所以必須嚴格遵從大小寫規則。
Java is case sensitive, so you must to comply with the rules.
2.沒有分號 No semicolon
程序語句之間必須有分號來隔開
Programming code need the semicolon to separate.
今天的教程到這裏完結,希望大家喜歡。如果你覺得這個教程十分有用或有任何錯誤的話,歡迎在下面留言。下一節的教程我將會教授變數。
This is the end of this tutorial. Hope you guys like it. If you think that this tutorial is useful or have any mistake , please say with me. The next tutorial will teach variables.