No, there just has to be a main method in every program. Basically, if you do
java myclass

there has to be a main method in there. To test the Dog class out, you can create a main method in it, or create a new program.

Code:
public class DogApp {
   public static void main(String args[]) {
      Dog d = new Dog("Snoop");
      d.bark();
   }
}
Code:
C:\java progys>javac *.java
C:\java progys>java DogApp