- 254 名前:デフォルトの名無しさん [2008/11/05(水) 00:01:41 ]
- >>249
です。ちょっとわかりにくかったので自分が考えたプログラムを途中まで載せます import java.util.*; public class Sample { public static void main(String[] args) { String str = null; ArrayList<String> list = new ArrayList<String> (); Scanner stln = new Scanner(System.in); System.out.print("input:"); while(!((str = stln.next()).equals("end"))) { list.add(str); System.out.print("input:"); } System.out.print("search: "); //検索 ? System.out.println(list.contains(?)); System.out.print("add: "); //追加 ? System.out.println(list.add(?)); System.out.print("delete: "); //削除 ? System.out.println(list.remove(?)); System.out.print("allprint: "); //すべて出力 ? System.out.println(list.get(?)); } } ?のところに何を入れればよいのかがわかりません(?以外のところも間違っているかも)。 考え方としては初期の文字列としてwhile文の中で文字列を生成して、それに対し検索などを行おうとしています。
|

|