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

Joined Date :04-Feb-2013
Articles
Posted
27
Messages
Posted
0


   
Messages
Posted:
Post Your Comments
Name (Max 50 Chars)
Comments

TekTipsDownload
GateExam
Academic Projects
TekTipsExperts



 
Site optimized for IE7, 1280 X 768 and above. Copyright © 2010 - 2018 KTS InfoTech
Site Developed Using KTS WebCloud