どうも、Java勉強中の西尾です。 Javaって難しいですね…。 今日はようやくリストを作る方法を理解したので、 自分の勉強のためにまとめてみたいと思います。 普段Pythonの記事ばっかりなのでたまには気分を変えて。 Pythonでは「複数のオブジェクトが入った配列のようなオブジェクト」を下のような記法で作成できます。 >>> xs = [1, 2, 3.14, "Hello!"] JavaScriptやRubyでも同じで、Perlだと@xs = (1, 2, 3.14, "Hello")になるようです。 また、このオブジェクトの中身を順に表示するにはfor文を使います。 >>> for x in xs: print x 1 2 3.14 Hello! これと同じことをJavaではどう書けばいいのか、 今日やっと理解しました。 Javaでは下のようになります。 Object[] xs =