Well when i use my getter and setter from a static method from another class everything is okay but it gives a warning that it should be used in a static context. So when I dont use any getters or setters it takes away that warning but what is still better to use?
Asked
Active
Viewed 245 times
0
-
2First learn what `static` methods and fields are and then you will understand when to use them. – Sotirios Delimanolis Oct 21 '13 at 23:50
-
1if you have something like: `MyClass c = new MyClass(); c.getMyVar()` and you `getMyVar()` is static, you will get this warning. In that case use `MyClass.getMyVar()`. – Daniel Gabriel Oct 21 '13 at 23:51
-
You have to explain this problem in more detail. I've a rough idea what you are talking about, but to give you a good answer easily, you need to provide more context. You should not shift off this work of creating the question context to the answering person. E.g. give code examples where your class names and usage are obvious. This way, the person answering your question can use these names in his explanation and it's already clear what they mean, because you provided the vocabulary in which the answer can be expressed. – Daniel S. Oct 22 '13 at 00:00