Sms

mmmmxmmwmmwmmm °

ffilfilfôi!^*(AAffiAfê-ffiM)Aiâ'MTMfôM^-^ m) ° SAifôAgPfô ' S^AmA^ * A^ñm * MK^AAAA^ ' AA

mmmm^-m. A#Är/j mama • m-ñ^A^mmmsmrn^ mmmitm/ • mimmmm. rAj (um^mm^Ammmm^mmm °

' iMwamm(Abstract Class) °

Step 3. ffiefflmffiRKwim^"

public abstract class Person {

public abstract void Display();

// EX03 01 // Person.java package _objects; public abstract class Person { protected String name; public void SetName(String na)

// Employee.java package _objects;

public class Employee extends Person { public void SetName(String na) { super.SetName(na); } public void Display()

{ System.oMi.println("Employee: " + name ); }

// JMain.java import _objects.*; public class JMain {

public static void main(String[] args) { Person p = new Employee(); p.SetName("Peter Chen"); p.Display();

Mm ' immm^m&m Person::DisplayOa«ffi^& (SPftWWlft) ®

mm? ^mm ■ 3 wiitm^mi^ • mm Displayo m^n public class Employee { private String name; private int salary;

public void SetName( String na) { name = na;

public class Customer {

public voidSetName(String na) {

name = na public void SetSalary(int s) { salary = sa

{ System.out.println("Emp: " + name + ' 'Salary: '' + salary);

public class Person { private String name;

iEfflmisMMffiiitmA' mr:

public class Person { private String name;

public abstract class Person { private String name;

public void SetName(String na) { name = na; } public abstract void Display();

0 0

Post a comment