“Abstraction is a
process of hiding the implementation details and showing only functionality to
the user.”
Another
way, it shows only important things to the user and hides the internal details
for example sending sms, you just type the text and send the message. You don't
know the internal processing about the message delivery.
Abstraction
lets you focus on what the object does instead of how it does it.
Abstraction is "To represent the
essential feature without representing the back ground details."
Abstraction lets you focus on what the
object does instead of how it does it.
Abstraction provides you a generalized
view of your classes or object by providing relevant information.
Abstraction is the process of hiding the
working style of an object, and showing the information of an object in
understandable manner.
Real world Example of
Abstraction: -
Suppose you have an object Mobile Phone.
Suppose you have 3 mobile phones as
following:-
Nokia 1400 (Features:- Calling, SMS)
Nokia 2700 (Features:- Calling, SMS, FM
Radio, MP3, Camera)
Black Berry (Features:-Calling, SMS, FM
Radio, MP3, Camera, Video Recording, Reading E-mails)
Abstract information (Necessary and Common
Information) for the object "Mobile Phone" is make a call to any
number and can send SMS."
so that, for mobile phone object you will
have abstract class like following:-
abstract class MobilePhone
{
public void Calling();
public void SendSMS();
}
public class Nokia1400 : MobilePhone
{
}
public class Nokia2700 : MobilePhone
{
public void FMRadio();
public void MP3();
public void Camera();
}
public class BlackBerry : MobilePhone
{
public void FMRadio();
public void MP3();
public void Camera();
public void Recording();
public void ReadAndSendEmails();
}
Abstraction in java is implemented using by two way :-
Abstract
class and interfaces.
-------------------->coming with Abstract class and Interface<-------------
Thanks
Keep Learning.. :)