Access decoration into similar bun class other
Private True false false
Default (friendly) True false false
Protected true True True False
Public true to True true True
Overload: Method name is the same, parameter list (parameter data type, number, etc.) is different
Rewrite: There is inheritance to override, subclass override method, method name, return value, parameter list same, access modifier cannot be more strict than parent class
Packagecom.jredu.ch06; Public classCalc {floats; //Overloading of methods//Calculate Circle Area Public floatCalcfloatR) {s= 3.14f * r*R; returns; } //Triangular Area Public floatCalcfloatWfloath) {s= W*H/2; returns; } Public floatCalcintWfloath) {s= W*H/2; returns; } //trapezoid Area Public floatCalcfloatW1,floatW2,floath) {s= (W1+W2) *H/2; returns; }}
Access modifier private/protected/Default (Friendly) protected method override, overloaded