public class testcheckusername
//長度大於6,
if(username.length()<=6)
//不能有數字
for(int i=0;i='0')
} system.out.println("使用者名稱符合要求");
}}
public class teststringconvert catch (parseexception e)
//輸出結果
system.out.println(age+" "+score+" "+enterdate);
}}
//定義訊號燈列舉
public enum signal
public class testsignal
}}
4.編寫遞迴演算法程式:一列數的規則如下: 1、1、2、3、5、8、13、21、34… 求數列的第40位數是多少。
public class testsum
public static long sum(int n) else if (n == 1 || n == 2) else
}}
public class testdirectory
public static void showtree(file file,int level);
system.out.println(searchrecursive(array, 0, array.length - 1, 20));
} /**
* 執行遞迴二分查詢,返回第一次出現該值的位置 *
* @param array 已排序的陣列
* @param start 開始位置
* @param end 結束位置
* @param findvalue 需要找的值
* @return 值在陣列中的位置,從0開始。找不到返回-1
*/public static int searchrecursive(int array, int start, int end,
int findvalue)
if (start <= end) else if (findvalue < middlevalue) else
} else
}}
Java常用工具類練習
public class testcheckusername 長度大於6,if username.length 6 不能有數字 for int i 0 i 0 system.out.println 使用者名稱符合要求 public class teststringconvert catch pars...
開發中常用工具
無論ios開發還是android,在開發過程中會經常使用工具,也好長時間沒有寫部落格了,今天剛吃完午飯,就在這裡總結一下,自己經常會使用的一些工具或者工具 1.iconfont這裡有各種各樣的向量圖示,而且可以自主設定圖示大小,顏色 2.sublime text2一款非常好用的文字編輯器 3.ios...
java常用工具類作業
public class demotest 輸出結果 請輸入乙個日期 4月9日2019年 2019年4月9日2.給出乙個隨機字串,判斷有多少字母?多少數字?思路 先把string字串轉換成字元陣列,在用迴圈出來的字元跟ascii比較,大寫字母的ascii值在65 90之間,小寫字母在97 122之間...