explain oops concepts with examples?

Answer Posted / sunil

oops....its a object oriented concept....
this concept is used in different language for reducing line
of code,complexity..
oops having 4 important pillar.
1)Abstraction:
*Hide unnecessary data and show only important think.
*we can create method of abstract class if method is
Abstract method.
2)Encapsulation:
* Binding data and provide security.
ex..
create
class A
{

}

class A binding all methods,variable etc..
and provide security.

3)Polymorphism
same think but behave differently..
Same method name but different parameter...
ex..Method A(int a,int b)//A method name and 2 parameter.
{
}
Method A(int a,int b,int c)//A method name and 3 parameter.
{
}
4)Inheritance
Ability to create new class from existing class...
*inheritance variable,method from existing class
ex..
class A
{
int a,b,c;
}
class B:A
{

}
so we dont need to declare these variable again class B bcoz
these variable inherit from existing class .

Is This Answer Correct ?    2 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are locale settings?

558


What is a constructor, constructor overloading in java?

536


How do generics work?

524


What is jpa specification?

548


Where import statement is used in a java program?

618






How to avoid memory leak in java?

609


What is difference overloading and overriding?

584


How to convert string to char and vice versa?

524


What is a dynamic array in java?

569


What is protected access modifier?

592


What are the different types of sorting in java?

546


what is thread in Java ?

634


Why hashcode is used in java?

508


List out benefits of object oriented programming language?

493


What are the types of collections in java?

550