KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
The very common beginner mistake is when you try to use a class property "statically" without making an instance of that class. It leaves you with the mentioned error message: You can either make the non static method static or make an instance of that class to use its properties. What the reason behind this? Am not concern with the solution, rather the reason. private java.util.List<String> someMethod(){ /* Some Code */ return someList; } public static void main(String[] strArgs){ // The following statement causes the error. java.util.List<String> someList = someMethod(); }
Tags (comma-separated)
Save Edits
Cancel