-2

Usually when there is getter/setter in a POJO class, the general convention I have seen until now was to use return this.<instance variable> / this.<instance variable> = something

But, the current project I am working on uses a strange convention of return <class name>.<instance variable>

I understand that this works, but was wondering if this is the right approach at all?

Sara
  • 603
  • 8
  • 19

1 Answers1

-2

You have to make that variable or method static then you can use through class name.

public static int a=5;
/*declaring static variable*/



  System.out.println(classname.a);
  /*calling static variable*/
Adriaan
  • 17,741
  • 7
  • 42
  • 75
Rahul sharma
  • 1,492
  • 12
  • 26