Search:

Type: Posts; User: Norm

Search: Search took 0.13 seconds.

  1. Re: Error message non-static method Person.getFirstName() cannot be referenced from a static context?

    You do NOT need a reference to the class to call other methods of the same class. There is an implied this reference added by the compiler. Just code the method name without any object reference.
  2. Re: Error message non-static method Person.getFirstName() cannot be referenced from a static context?

    Don't make any of the methods static. Use references to the class object to call a class's methods.
  3. Re: Error message non-static method Person.getFirstName() cannot be referenced from a static context?

    A toString() method definitely should not be static.

    When you call the toString() method, use a reference to the class, not the name of the class.
    Using the class's name means it's a call to a...
Results 1 to 3 of 3