> I still get the following error:
>
> XListen.java:69: non-static method printPacket(java.io.PrintStream,byte[])
> canno
> t be referenced from a static context
>
>  XDump.printPacket(System.out, packet);
>  ^
>
> How can I resolve it?

I would guess XDump is a class:
you can only invoke the "non-static" printPacket(...) on an object
instantiated from the class.

public class A {
  public static void foo() {System.out.println("foo");}
  public void bar() {System.out.println("bar");}
}

// elsewhwere
A.foo()  // okay, foo is static, has no corresponding instantiated object
A.bar()  // bad! bar is not static! (you can't invoke it directly on a class)
(new A()).bar() // okay, you are calling bar() on an instantiated object


Paul
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to