-1

my professor was talking about the method ping being non-static:

enter image description here

Could someone explains why the ping method is non-static? He was saying that we basically don't know whether it is A's ping or B's ping being called. But I don't quite understand what he meant when he said that.

hodondo
  • 13
  • 3
  • 1
    Relevant tutorials: [Static vs Instance](https://www.cis.upenn.edu/~matuszek/cit591-2006/Pages/static-vs-instance.html), and also [The Java Tutorials: Understanding Class Members](https://docs.oracle.com/javase/tutorial/java/javaOO/classvars.html) – Hovercraft Full Of Eels May 13 '22 at 00:16
  • 1
    Also, that Java code won't compile and doesn't make sense since you're trying to refer to an instance variable from within a static method. The variable also is null unless it is initialized. – Hovercraft Full Of Eels May 13 '22 at 00:24

0 Answers0