title: Why does System.out.println have to be inside a method?
body: <pre><code>class Employee {    
      int DOB;
      int eid;
      String name;
      double salary;
      System.out.println("Employee class");
  }
  </code></pre>
  
  <p>If I write the <code>System.out.println</code> inside a method,it seems to work. But not when written directly inside a class. Why is a method necessary?</p>