How To Implement Final Method In Java
Rate this article
0 out of 5
In this tutorial we will show you how to implement final method in java. After viewing the video tutorial, download the source code and try to modify the code so as to get a feel of what is learned in this video tutorial.


Source Code
FinalMethod.java

import java.io.*;
class Bank
 {
    String name;
    long acno;
    double amt;
 Bank(String nam,long no,double am)
 {
  name=nam;
  acno=no;
  amt=am;
 }
 }
class Customer extends Bank
  {
   String addr;
   int pin;
   long mob,phone;
 Customer(String nam,long no,float am,String add,int p,int m,int ph)
 {
  super(nam,no,am);
  addr=add;
  pin =p;
  mob=m;
  phone=ph;
 }
 final void display()
  {
   System.out.println("Address="+addr);
   System.out.println("Pin="+pin);
   System.out.println("Mobile="+mob);
   System.out.println("Phone="+phone);
  }
 }
class Savings extends Customer
  {
   String type;
   float interest;
 Savings(String nam,long no,float am,String add,int p,int m,int ph,String ty,float in)
 {
  super(nam,no,am,add,p,m,ph);
  type=ty;
  interest=in;
 } 

void display()
 {
  System.out.println("Name="+name);
  System.out.println("Account No="+acno);
  System.out.println("Amount="+amt);
  System.out.println("Type="+type);
  System.out.println("Interest="+interest);
 }
 }
class Finalmethod
 {
  public static void main(String args[])
   {
    System.out.println("***Customer Profile***");
    Savings sbt=new Savings("Ammu",100,55555,"Madhavam",685561,897654321,897654,"current",12);
    sbt.display();
  }
}


Source Code

About The Author
TekTips Videos

Number Of articles Posted      : 27
Number Of Messages Posted  : 0
Joined Date : 2013/2/04
   
Author
Messages
Posted:
Post Your Comments  
Name (Max 50 Chars)
Comments
 
 

 
TekTipsDownload
GateExam
Academic Projects
TekTipsExperts
Android