CoolInterview.com - World's Largest Collection of Interview Questions
Send Free SMS
 Interview Questions  
 Our Services  


INTERVIEW QUESTIONS J2EE JAVA DETAILS
Question :
Why JAVA not support multiple inheritance? How can we pass address of an object?


Posted by: pushpa on 5/19/2008

Contact pushpa  Contact pushpa
Category Java Interview Questions
Rating (0.0) By 0 users
Added on 5/19/2008
Views 734
Rate it!
Answers:

In java first edition there is no multiple inheritance,but later editions they provided indirect multiple inheritance by interfaces and extends.



 Posted by: yaswanth    

Contact yaswanth  Contact yaswanth

Java does not support multiple inheritance because it leads to confusion to the programmer. It is prove in the following ex.

Class A
{
int x;
}
Class B
{
int x;
}
Class c extends A,B
{
x=10;// Java compiler does not //know whether it is x of class A //or x of class B.
}
in java
Class C extends A,B
Multiple inheritance is achieved by using single inheritence.

ex;
Class A
{
int a;
}
class B extends A
{
int b;
}
class C extends B
{
a=10;
b=20;
}
we can pass add of an obj as follows
Class A
{
A(int add)
{
int address=add;
System.out.println("Address="+add);

}
}
Class Addr
{
public static void main(String args[])
{
A add=new A(add);
}
}




 Posted by: P.Naren Kumar Reddy    

Contact P.Naren Kumar Reddy  Contact P.Naren Kumar Reddy

I think example given above for Passing address of object is incorrect. and every object is passed by reference in java



 Posted by: radha    

Contact radha  Contact radha


If you have the better answer, then send it to us. We will display your answer after the approval.
Name :*
Email Id :*
Answer :*
Verification Code Code Image - Please contact webmaster if you have problems seeing this image code Not readable? Load New Code
Process Verification  Enter the above shown code:*
Inform me about updated answers to this question

   
Related Questions
View Answer
In How many ways we can request the System for the garbage collection to cleanup the memory? And what are the differences?
View Answer
Why java is not pure object oriented language?
View Answer
what is the definition of arraylist? plz write in brief.
View Answer
1)What are the actual functions of JVM?
2)When to use a class and when to use
an Abstract class?
3)what is the use of constructors other than creation of objects?
4)when to use constructors?
5)when to use Interface?
6)why java does not support pointers?
7)why multiple inheritance is not possible in java without using Interfaces?
View Answer
Why we have used to in main method in JAVA this words
1)public
2)static
3)void
4)main
5)(String args[])
View Answer
Addition of two numbers using Bitwise operators.
Reading An 2D array using single for loop
View Answer
What is UML patterns?give me clear explanation
View Answer
While developing one in JSP page we are sending request to Struts frame work.If we click two times submit button then First time only it should accept request and second time should reject that request in struts frame work.

How we can do that in controller itself...I am waiting for your Response...

View Answer
Can I execute or call one applet from another applet? If so then how??? Please Reply me...
Thanks
View Answer
what is method declaration,method attributes,method modifiers and parameters
View Answer

Please Note: We keep on updating better answers to this site. Subscribe to our newsletter to get notified when better answer is posted.

Notify me when better answer is posted!
Email:

View ALL Java Interview Questions

User Options
Sponsored Links


Copyright ©2003-2010 CoolInterview.com, All Rights Reserved.
Privacy Policy | Terms and Conditions
Page URL: http://www.coolinterview.com/interview/12824/default.asp?cachecommand=bypass


Download Yahoo Messenger | Placement Papers| FREE SMS | ASP .Net Tutorial | Web Hosting | Free SMS | Dedicated Servers | Joke of the Day

0.77