Output:
Click Here For Java Online Compiler
Solution:
*** Simple Class and Object Example *** Employee name : Alee Employee age : 19 ----------------------------- Employee name : Ahmed Employee age : 44 -----------------------------
Click Here For Java Online Compiler
Solution:
/** * * @author Alee Ahmed Kolachi */ class Employee { String name; int age; public void showDetails() { System.out.println("Employee name : " + name); System.out.println("Employee age : " + age); System.out.println("-----------------------------"); } public static void main(String[] args) { System.out.println("*** Simple Class and Object Example ***" + "\n"); Employee employee = new Employee(); employee.name = "Alee"; employee.age = 19; employee.showDetails(); Employee employee2 = new Employee(); employee2.name = "Ahmed"; employee2.age = 44; employee2.showDetails(); } }
comment 0 comments:
more_vertsentiment_satisfied Emoticon