Don\'t want any code, just want some sort of guidance. Would like to keep my academic integrity in tact ;)
I keep getting that annoying error. I need to call the toS
Look at the following code, you can compile toString with a static variable without a new object, it just throw exception at run time
demo>cat Test.java
class Water {
public String toString() {return "whatever";}
}
public class Test {
static Water water;
public static void main(String...args) {
System.out.println(water.toString());
}
}
demo>javac Test.java
demo>java Test
Exception in thread "main" java.lang.NullPointerException
at Test.main(Test.java:8)