.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Code Snippets >> OOPS >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Concadination Name Using Multilevel Inheritance

Posted By:NATHAN ISRAEL       Posted Date: September 21, 2012    Points: 40    Category: OOPS    URL: http://www.dotnetspark.com  

Concadination Name Using Multilevel Inheritance
 

import java.io.*;

class First
{
    String fname;
    void showfname()
    {
        System.out.println("First Name : " + fname);
    }
}

class Last extends First
{
    String lname;
    void showlname()
    {
        System.out.println("Last Name : " + lname);
    }
}

class Full extends Last
{
    void fullname()
    {
        System.out.println("Full Name  : " + (fname +" "+lname));
    }
}

class Multilevel_Inheritance
{
    public static void main(String args[]) throws IOException
    {
        Full fn = new Full();
        
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        System.out.println("Enter Your First Name : ");
        fn.fname = br.readLine();

        System.out.println("Enter Your Last Name : ");
        fn.lname = br.readLine();    

        System.out.println();

        fn.fullname();

        System.out.println();

    }
}

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend