1. 程式人生 > >初識Java(1)

初識Java(1)

單行註釋 chapter rgs pen 空格 分享 pan pre 修飾

1.java的執行順序
javac(編譯) java(運行)
編寫源碼----->字節碼文件----->執行
2.編寫源碼註意
a.類名和文件名一致
b.括號要成對出現
3.print和println的區別
print:不會換行
println:會換行
4.轉義字符
\n:表示換行
\t:表示空格
5.java註釋
//:單行註釋
/* */:表示多行註釋
/** */:表示文檔註釋
6.java代碼規範
a.類名要用public修飾
b.一行只寫一個語句
c.註意{}的位置
d.代碼層次關系縮進(Teb鍵)

技術分享
 1 package chapter1;
 2
3 public class HelloWorld { 4 public static void main(String[] args){ 5 6 System.out.print("HelloWorld\t"); 7 System.out.println("HelloWorld"); 8 9 System.out.print("張三\t18"); 10 } 11 }
代碼示例

初識Java(1)