I tested this in eclipse, and it didn't give me any exceptions. However I wasn't able to specify the value x. Can toString() take an argument (I know that my example below isn't the greatest)?
Test.java
public class Test {
public String toString(int x){
return "Hey "+ x;
}
}
Main.java
public class Main {
public static void main(String[] args){
System.out.println(new Test());
}
}