public class Employee
{
    static String companyName = "XYZ Corporation";      //static field
    static int    employeeCount;
    String lastname;                                    //instance field
    String firstname;

    Employee(String first, String last)                 //constructor
    {
        firstname = first;
        lastname  = last;
        employeeCount++;
    }

    static void printCompInfo( )                        //static method
    {
        System.out.print(companyName +" #");            //accessing static field
        System.out.println(employeeCount);             
//or    System.out.print(Employee.companyName +" #");   //more formal
//or    System.out.println(Employee.employeeCount);      
        System.out.println();
    }

    void printEmpInfo( )                                //instance method
    {
        System.out.print(companyName          +"--");   //accessing static field
//or    System.out.print(Employee.companyName +"--");   //more formal
//or    System.out.print(this.companyName     +"--");   //or even using "this"

        System.out.println(lastname);                   //accessing instance field
//or    System.out.println(this.lastname);              //using "this"
        System.out.println();
    }


    //======================================================================
    // A static main method
    //======================================================================
    public static void main(String[ ] args)             //static method
    {
        printCompInfo( );                               //call static method
//or    Employee.printCompInfo( );                      //less common

        Employee  e1 = new Employee("Sam", "Sultan");   //instantiate an object of this class
                                         
        printCompInfo( );                               //call static method
//or    Employee.printCompInfo( );                      //less common
//or    e1.printCompInfo( );                            //even less common
 
        e1.printEmpInfo( );                             //call instance method
    }
}