final in java


final class Parent{
 final  int amount=5000;
  Parent(){}
 
  Parent(int receive){
   amount+=receive;
  }

final void home(){
 
  System.out.println("Location:Delhi");
 
 }

 void balance(){
 
  System.out.println("balance="+amount);
 }


}

class Test{


 public static void main(String ar[]){

 
 // Child objChild =new Child(500);
  //objChild.homeBalance();
 
 }

}

Reactions:

0 comments:

Post a Comment