-JAVA-Im trying to dynamically create objects and then slap them on array list

Pages: 123
closed account (3hM2Nwbp)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

class X
{
  public void x()
  {
  }

  public static void y()
  {
  }



public static void main(String[] _)
{
   X.x(); // fails -- cannot call X.x from a static context
   X.y(); // good -- y is static

   X x = new X();
   x.x(); // good - called x.x on an object
   x.y(); // works, but should really be X.y()
 }
}


Has your code changed since your OP?
Last edited on
No,[shame]I've been playing minecraft[/shame]

EDIT: thats very helpful, I understand so much better, maybe i will pop objlist in a little wrapper :/
Last edited on
Topic archived. No new replies allowed.
Pages: 123