Issue
I just wrote a constructor like this:
public ArchivesManager(String identifier) {
String[] components = String.split("\nNEW");
}
But there's an error message: non-static method split(java.lang.String) cannot be referenced from a static context
. I know that error message, but why is the constructor static?!
Solution
It's because split should be called on a String object. I.e.
String foo = "Hello, world";
String[] arr = foo.split(",");
Answered By - Jim
Answer Checked By - Katrina (JavaFixing Volunteer)