.Summary from OOP lessons 16 October 2012.
Some of Access Modifier
- public : it means able be access to all package
- private : it means only able access in the class it made before.
- protective :extends : express the subclass or childclass
- instantiation : is making variable become object with example
new name.variable();
- inheritance : is degration from parent class to the subclass.
- abstraction : is making a class
- polymorphsm : is a decleration object that change or change the form.
- when we write "public abstract class Aves" : it means can't be a object. it purposes for avoiding a mistake.
- Constructur : is making the same method to the same class
the example of methode overloading :
public Bird(int v)
{
super ();
this.flyVelocity = 0 ; /*contoh konstruktur*/
System.out.println("kecepatan burung = 7");
}
public Bird (String x)
{ super ();
this.food = null ;
System.out.println("makanan burung = taik ");
}
- its same with methode overloading : but the condition, the signature must be diffrent.
- the example of signature is public (name.variabel like int or string)
{ super (); this.furColor=;
}
example : public bird (int) with public bird (string)
- method overwrite : the same methode in the subclass or in the condition must be same
- we use super for the parents contructur and constructur proccess when the instatiation.
0 komentar:
Posting Komentar