Solution:
Well, the problem occurred in the line
public static void sampleString();
when you put the semicolon ( ; ) on the end of the line. Ending a function with a semicolon intends that you want it to be abstract and not have a body in this method. This is comparable to how methods in interfaces are declared.
To avoid such error the best practice is to put the curly brace end of the line like this
public static void sampleString(){
System.out.println("I am a string!");
}
One more thing, you don’t need to put the line
System.exit(0);
within the main function. The main function will automatically be terminated by itself by executing the method sampleString();
I hope this might help you.