剛剛有人問的main2()不印的問題

看板java作者時間19年前 (2006/03/17 02:25), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/2 (看更多)
import java.io.*; public class ptt { static void main2() { int i = 1; prt(" i : " + i ); prt("++i : " + ++i); // Pre-increment prt("i++ : " + i++); // Post-increment prt(" i : " + i ); prt("--i : " + --i); // Pre-decrement prt("i-- : " + i--); // Post-decrement prt(" i : " + i ); } static void prt(String s) { System.out.println(s); } static void usecommand() { System.out.println("Please use command"); System.out.println("Choose [1|2|3|4]:"); } public static void main (String[] args)throws IOException { InputStreamReader in=new InputStreamReader(System.in); BufferedReader buf=new BufferedReader(in); int a; String str=buf.readLine(); a=Integer.parseInt(str); if (a !=1) { usecommand(); return; } else { main2(); return; } } } //這樣有解問題嗎?....我也才剛學XD -- 當 免費續杯 日 http://www.wretch.cc/user/pijiu -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 59.104.108.153
文章代碼(AID): #146Qsscx (java)
文章代碼(AID): #146Qsscx (java)