Advertisement
arafaee

EmployeeStaticTest.java

Apr 17th, 2017
297
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.03 KB | None | 0 0
  1.  
  2. /**
  3.  * 8.12 EmployeeStaticTest.java
  4.  *
  5.  * @author Hafara Firdausi/ 5115100043
  6.  * @version 01
  7.  */
  8.  
  9. public class EmployeeStaticTest
  10. {
  11.    public static void main(String[] args)  
  12.    {  
  13.       //show that count is 0 before creating Employees
  14.      System.out.printf("Employees before instantiation: %d\n", EmployeeStatic.getCount() );  
  15.      
  16.      EmployeeStatic e1 = new EmployeeStatic("Susan", "Baker");  
  17.      EmployeeStatic e2 = new EmployeeStatic("Bob", "Blue");  
  18.      
  19.      System.out.println("\nEmployees after instantiation: ");  
  20.      System.out.printf("via e1.getCount(): %d\n", e1.getCount());  
  21.      System.out.printf("via e2.getCount(): %d\n", e2.getCount());  
  22.      System.out.printf("via EmployeeStatic.getCount(): %d\n", EmployeeStatic.getCount());  
  23.       // get names of Employees
  24.      System.out.printf("\nEmployee 1: %s %s\nEmployee 2: %s %s\n",  
  25.        e1.getFirstName(), e1.getLastName(),  
  26.        e2.getFirstName(), e2.getLastName());  
  27.      e1 = null;  
  28.      e2 = null;  
  29.    }
  30. } //end class EmployeeTest
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement