Multiple Inheritance using Interface in Java

The interface is a kind of class, it contains methods and variables. It defines only abstract methods and final fields. It has the following syntax:

interface Interface-Name
{
variable declaration;
methods declaration;
}

We can demonstrate multiple inheritance by interface in Java is given as follows:

class Student
{
int roll;
void getNumber(int n)
{
roll=n;
}
void putNumber()
{
System.out.println("Roll No is:"+roll);
}
}
class Temp extends Student
{
int part1, part2;
void getMarks(int p1, int p2)
{
part1=p1;
part2=p2;
}
void putMarks()
{
System.out.println("Marks Obtained:");
System.out.println("Part 1:"+part1);
System.out.println("Part 2:"+part2);
}
}
interface Sports
{
int sportswt=5F;
void putwt();
}
class Results extends Temp implements Sports
{
int total;
public void putwt()
{
System.out.println("Sports Wt":+sportswt);
}
void display()
{
total=part1+part2+sportswt;
putNumber();
putMarks();
putWt();
System.out.println("Total Score:"+total);
}
}
class Multi
{
public static void main(String args[])
{
Results r1=new Results();
r1.getNumber(105);
r1.getMarks(25F, 35F);
r1.display();
}
}