staticイニシャライザとstatic変数について仮テストの問題で間違えまくったので勘違いと正解について軽くまとめようと思います。 勘違いしやすいポイントとしてはstatic変数は共有の変数であるため別のインスタンスで再代入をしてしまうとすべての ...
public class Test { static void func() { System.out.print("func() /"); } public static void main(String[] args) { Test.func(); Test t = new Test(); t.func ...
Belongs to the class rather than any specific object. Can be called without creating an instance of the class. Cannot access non-static (instance) variables or methods directly because it does not ...