Skip to main content

Implementation of Hybrid inheritance in Java


Implementation of Hybrid inheritance in Java with the help of INTERFACE


CODE>>


class Student
{
    int rollNumber;
    void getNumber(int n)
    {
        rollNumber=n;
    }
    void putNumber()
    {
        System.out.println("Roll No :: "+rollNumber);
    }  
}


class Test extends Student
{
    float part1,part2;
    void getMarks(float m1,float m2)
    {
        part1=m1;
        part2=m2;
    }
    
    void putMarks()
    {
        System.out.println("Marks Obtained\n");
        System.out.println("PART1: "+part1);
        System.out.println("PART2: "+part2);
    }
}


interface Sports
{
    float sportWt=6.0F;
    void putwt();
}


class Results extends Test implements Sports
{
    float total;
    public void putwt()
    {
        System.out.println("Sports Wt="+sportWt);
    }
    void display()
    {
        total=part1+part2+sportWt;
        putNumber();
        putMarks();
        putwt();
        System.out.println("Total Score= "+total);
    }
}


class hybrid
{
    public static void main(String args[])
    {
        Results student1=new Results();
        student1.getNumber(1234);
        student1.getMarks(17.4F, 33.0F);
        student1.display();
    }
}

Comments

Popular posts from this blog

A Hit Count Using Java Servlet's Session Tracking

import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class SessionTracker extends HttpServlet {         public void doGet(HttpServletRequest req,HttpServletResponse res)         throws ServletException,IOException         {                res.setContentType("text/html");                PrintWriter out=res.getWriter();                HttpSession session=req.getSession(true);                Integer count=(Integer)session.getValue("tracker.count");                if(count==null)       ...

Java Sample: While loop

public class whilechk1 {     public static void main(String args[])     {         int row,column,y;         System.out.print("\nMultiplication Table\n");         row=1;         do         {             column=1;             do             {                 y=row*column;                 System.out.print("\t"+y);                 column++;             }while(column<=10);             System.out.println("\n");             row++;         }while(row<=10);     } }

Types of Backups in RMAN

RMAN is very flexible and it offers many different types of backups.  We need to start with a list of backup types: ·           Full backup:   A full backup backs up all data files in the database, block-by-block, a standalone backup with everything you need to recover to the point in time when the full backup was collected. ·           Level 1 backup:   A level 1 backup includes only those blocks that have been changed since the “parent” backup was taken. Remember a parent backup may be either a level 0 or a level 1 backup. ·           Level 0 backup:   A level 0 incremental backup is physically identical to a full backup and it includes every data block in the file except empty blocks. The only difference is that the level 0 backup is recorded as an incremental backup in the RMAN repository, so it can be used as the parent f...