I've been programming for a few days, I'm using Deitel's How to program.
In this case the app class GradeBookTest is meant to create and use an object of the class GradeBook, but everytime I try to run GradeBookTest I get the cannot find symbol error. I know it's probably something stupid but I've been looking for the solution without success.
GradeBook.java:
public class GradeBook
{
public void displayMessage();
{
System.out.println("Welcome to the Grade book!")
}
}
GradeBookTest.java:
public class GradeBookTest
{
public static void main(String[] args)
{
GradeBook myGradeBook = new GradeBook();
myGradeBook.displayMessage();
}
}
I have made some minor changes that will work for you
class GradeBook {
public void displayMessage() { // removed semi colon from your code
System.out.println("Welcome to the Grade book!"); // added semi colon to your code
}
}
public class GradeBookTest {
public static void main(String[] args) {
GradeBook myGradeBook = new GradeBook();
myGradeBook.displayMessage();
}
}
Output
Welcome to the Grade book!