方法 | 描述 |
---|---|
void println() void println(boolean x) void println(char x) void println(char[] x) void println(double x) void println(float x) void println(int x) void println(long x) void println(Object x) void println(String x) | 印出參數,包括新行符號 |
舉例如下
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | class PrintlnDemo { public static void main(String[] args) { boolean a = true ; char b = '1' ; char [] c = { '1' , '0' }; double d = 1.0 ; float e = 1 .0f; int f = 1 ; long g = 1 ; Object h = new Object(); String i = "1" ; System.out.println(a); System.out.println(b); System.out.println(c); System.out.println(d); System.out.println(e); System.out.println(f); System.out.println(g); System.out.println(h); System.out.println(i); } } /* 《程式語言教學誌》的範例程式 檔名:PrintlnDemo.java 功能:示範物件導向的基本觀念 作者:張凱慶 時間:西元 2010 年 10 月 */ |
編譯後執行,結果如下

中英文術語對照 | |
---|---|
類別 | class |
屬性 | field |
方法 | method |
參數 | parameter |
參考資料
http://download.oracle.com/javase/6/docs/api/java/lang/System.html
http://download.oracle.com/javase/6/docs/api/java/io/PrintStream.html
http://download.oracle.com/javase/6/docs/api/java/lang/System.html
http://download.oracle.com/javase/6/docs/api/java/io/PrintStream.html
沒有留言:
張貼留言