タグ

ブックマーク / www.searchman.info (1)

  • staticの意味を徹底的に理解する

    <IT技術の処方箋:staticの意味を徹底的に理解する> staticは、クラス特有の値をもち、オブジェクト毎に値を持ちません。 と言っても慣れていない方はチンプンカンプンでしょう。 そこで、以下のサンプルで覚えましょう。 2つのサンプルjavaを用意します。 ●一つ目 class Study_static{ static int a; int b; } ●二つ目 public class HelloWorld { public static void main(String args[]) { System.out.println("Hello World!"); Study_static x = new Study_static(); x.a = 1; x.b = 2; Study_static y = new Study_static(); y.a = 3; y.b = 4; Sy

    kimikimi714
    kimikimi714 2012/03/05
    staticの意味
  • 1