Monday 17 September 2012

35.OOPS concept in JAVA II


Q1) What is multiple inheritance and does java support?

Ans) If a child class inherits the property from multiple classes is known as multiple inheritance.
Java does not allow to extend multiple classes but to overcome this problem it allows to implement multiple Interfaces.

Q2) What is abstraction?

Ans) Abstraction is way of converting real world objects in terms of class. For example creating a class Vehicle and injecting properties into it. E.g

public class Vehicle {

public String colour;
public String model;
}

Q3) What is encapsulation?

Ans) The encapsulation is achieved by combining the methods and attribute into a class. The class acts like a container encapsulating the properties. The users are exposed mainly public methods.The idea behind is to hide how thinigs work and just exposing the requests a user can do.

Q4) What is Association?

Ans) Association is a relationship between two classes. In this relationship the object of one instance perform an action on behalf of the other class. The typical behaviour can be invoking the method of other class and using the member of the other class.

public class MyMainClass{
public void init(){
new OtherClass.init();
}
}
Q5) What is Aggregation?

Ans) Aggregation has a relationship between two classes. In this relationship the object of one class is a member of the other class. Aggregation always insists for a direction.

public class MyMainClass{
OtherClass otherClassObj = new OtherClass();
}
Q6) What is Composition?

Ans) Composition is a special type of aggregation relationship with a difference that its the compulsion for the OtherClass object (in previous example) to exist for the existence of MyMainClass.

Best Study Materials JAVA,
Java Tutorials PDF,
Java SCJP Questions,
Java Material Free Download,
Gate Study Material Free,
Java Tutorial Download,
SCJP Materials
Core Java Programming Questio…
SCJP Certification  


Er Ratnesh Porwal
Software Engineer
www.AeroSoftCorp.com
www.AeroSoft.in
www.AeroSoft.co.in
www.AeroSoftseo.com
On Line Assistence    :
Gtalk                          :   ratnesh.aerosoft@gmail.com
Y! Messenger                   :   ratnesh.AeroSoft@yahoo.com
Rediff Bol                  ratnesh.AeroSoft@rediffmail.com



AeroSoft Corp, Aviation Company, AeroSoft Aviation SEO Company, information of aerosoft seo company, information of aerosoft aviation seo company


No comments:

Post a Comment