Book by Yegor Bugayenko
Data : attributes or properties
Code : procedures called methods
Example : Cash VS CashConverter
public class Cash{
private int dollars;
Cash(int dlr){
this.dollars=dlr;
}
Cash(String dlr){
this(Cash.parse(dlr);
}
Cash(float dlr){
this((int)dlr);
}
}
public class Client{
private String name;
private String address;
private String birthdate;
}public class Address{
private int number;
private String Street;
private String City
private int PostalCode;
}class Pixel{ // Manipulator
void Paint(Color color);
}
Pixel center = new Pixel(50,50);
center.paint(new Color("red"));class Human{
private String Name;
private int Age;
public Human(String Name, int Age){
this.Name=Name;
this.Age=Age;
}
public String getName(){
return Name;
}
}