[Java 教學範例拷貝]- String 類別(3/3)

[Java 教學範例拷貝]- String 類別(3/3)

[Java 教學範例拷貝]- String 類別(3/3)

 

剛才找資料時發現一個的Java 教學網站,趕快發揮(C/P)的長才將它備份來,有需要的同好,歡迎來(C/P)一下^^。

 

拷貝來源:
http://openhome.cc/Gossip/JavaGossip-V1/
http://openhome.cc/Gossip/JavaGossip-V1/StringClass.htm

 

public class UseString {
public static void main(String[] args) {
String[] filenames = {"caterpillar.jpg", "cater.gif",
"bush.jpg", "wuwu.jpg", "clockman.gif"};
System.out.print("過濾出jpg檔案: ");
for(int i = 0; i < filenames.length; i++)
if(filenames[i].endsWith("jpg"))
System.out.print(filenames[i] + " ");
System.out.println("");
}
}

 

發表迴響

你的電子郵件位址並不會被公開。 必要欄位標記為 *