ALLInterview.com :: Home Page            
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
Google
   
 
Categories >> Software >> Java Related >> Java J2EE >> Core Java
 
 


 

 
 Core Java interview questions  Core Java Interview Questions (1720)
 Advanced Java interview questions  Advanced Java Interview Questions (331)
 Swing interview questions  Swing Interview Questions (43)
 EJB interview questions  EJB Interview Questions (134)
 Servlets interview questions  Servlets Interview Questions (255)
 Struts interview questions  Struts Interview Questions (195)
 JDBC interview questions  JDBC Interview Questions (187)
 JMS interview questions  JMS Interview Questions (9)
 SunOne interview questions  SunOne Interview Questions (3)
 J2EE interview questions  J2EE Interview Questions (71)
 Weblogic interview questions  Weblogic Interview Questions (145)
 Websphere interview questions  Websphere Interview Questions (14)
 Java Networking interview questions  Java Networking Interview Questions (20)
 Java J2EE AllOther interview questions  Java J2EE AllOther Interview Questions (87)
Question
What is the multilevel inheritance. and also give the Example 
of it ?
 Question Submitted By :: Punit Chauhan
I also faced this Question!!     Rank Answer Posted By  
 
  Re: What is the multilevel inheritance. and also give the Example of it ?
Answer
# 1
Plz send answer of this question my email -
punitchauhan22@gmail.com
 
Is This Answer Correct ?    6 Yes 4 No
Punit Chauhan
 
  Re: What is the multilevel inheritance. and also give the Example of it ?
Answer
# 2
a multilevel inheritence is one in which there exist one base
class ,one derived class and multiple intermediate base class.
 
Is This Answer Correct ?    6 Yes 7 No
Guest
 
 
 
  Re: What is the multilevel inheritance. and also give the Example of it ?
Answer
# 3
Multilevel inheritance is a java feature where the
properties of a class are inherited by a class which extends
one class and which extend its features...

Example:

public class A {
public String getName(){
return "Fatima";
}
}

public class B extends A {
public int getAge() {
return 25;
}
}

public class C extends B {
public String getAddress(){
return "Panvel,Navi Mumbai India";
}
}

public class D extends C {
public void print {
System.out.println(getName());
System.out.println(getAge());
System.out.println(getAddress());
}
}

This method would print the following in the console:
Fatima
25
Panvel, Navi Mumbai, India

Here in class D you are calling methods that are available
inside classes A, B & C. Though D extends only class C, it
would in turn inherit the properties of the classes extended
by C and its parents.

This is multi level inheritance.
 
Is This Answer Correct ?    13 Yes 2 No
Fatima Deshmukh
 
  Re: What is the multilevel inheritance. and also give the Example of it ?
Answer
# 4
Multilevel inheritance is a java feature where the
properties of a class are inherited by a class which extends
one class and which extend its features...

Example:

public class A {
public String getName(){
return "Fatima";
}
}

public class B extends A {
public int getAge() {
return 25;
}
}

public class C extends B {
public String getAddress(){
return "Panvel,Navi Mumbai India";
}
}

public class D extends C {
public void print {
System.out.println(getName());
System.out.println(getAge());
System.out.println(getAddress());
}
}

This method would print the following in the console:
Fatima
25
Panvel, Navi Mumbai, India

Here in class D you are calling methods that are available
inside classes A, B & C. Though D extends only class C, it
would in turn inherit the properties of the classes extended
by C and its parents.

This is multi level inheritance.
 
Is This Answer Correct ?    8 Yes 2 No
Fatima Deshmukh
 
  Re: What is the multilevel inheritance. and also give the Example of it ?
Answer
# 5
Multilevel inheritance is a java feature where the
properties of a class are inherited by a class which
extends one or more classes which extend its features.
example:

import java.io.*;
class superclass
{
void sum(int x,int y)
{
int add;
add=x+y;
System.out.println("addition="+ add);
}
}

class subclassA extends superclass
{
void subtraction(int a, int b)
{
int sub;
sub=a-b;
System.out.println("subtraction="+sub);
}
}

class subclassB extends subclassA
{
void multiplication(int m, int n)
{
int mult;
mult=m*n;
System.out.println("multipliction="+mult);
}
}

class subclassC extends subclassB
{
public static void main(String arg[])throws IOException;
{
BufferedReader br=new BufferedReader(new
InputStreamReader(System.in));
int p,q;
System.out.println("enter value in p");
p=Integer.parseInt(br.readLine());
System.out.println("enter value in q");
q=Integer.parseInt(br.readLine());
subclassC obj=new subclassC();
obj.multiplication(p,q);
obj.subtraction(p,q);
obj.sum(p,q);
}
}
 
Is This Answer Correct ?    5 Yes 1 No
Namrata
 

 
 
 
Other Core Java Interview Questions
 
  Question Asked @ Answers
 
write java code to print second max number in the array Huawei 12
What is multiple inheritance & can we implement it in java? Satyam 6
Name the class that used to read objects directly from a stream? Wipro 4
Write a program that takes a 5 digit number and calculates 2 power that number and prints it.   1
What is the difference between Resultset and Rowset. IBM 6
Is Java is 100% pure OOPS? Explain? ANZ 26
Same common question what is Map,Set,HashMap,List???? Symphony 4
What services that container provides?   2
Why Java is a platform independent language? Zensar 5
Suppose there is an Online shopping cart application having different objects like Cart, SelectionItem, Billing, COnfiguration, Authentication, Authorization, PersonalDetails etc. Out of this which one can be made a singleton pattern and why? RBS 2
diff. b/w JAVA and javascript... NIIT 3
Can you have an inner class inside a method and what variables can you access?   2
 
For more Core Java Interview Questions Click Here 
 
 
 
 
 


   
Copyright Policy  |  Terms of Service  |  Articles  |  Site Map  |  RSS Site Map  |  Contact Us
   
Copyright 2013  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  KalAajKal.com