Encapsulation VS Abstraction 1 Answer(s) 3 years and 7 months ago
Posted in : Java Beginners
View Answers
October 14, 2009 at 4:04 PM
Hi Friend,
Encapsulation-Encapsulation is a process of binding or wrapping the data and the codes that operates on the data into a single entity. This keeps the data safe from outside interface and misuse. One way to think about encapsulation is as a protective wrapper that prevents code and data from being arbitrarily accessed by other code defined outside the wrapper.
In other words, encapsulation is the ability of an object to be a container (or capsule) for related properties (ie. data variables) and methods (ie. functions). Ex: public class Box { private int length; private int width; private int height;
public void setLength(int p) {length = p;}
public void setWidth(int p) {width = p;}
public void setHeight(int p) {height = p;}
public int displayVolume() {System.out.println(length*width*height)... }
public static void main(String args [ ]) { Box b1=new Box(3,4,5); b1.displayvolume(); } Abstraction-The process of abstraction in Java is used to hide certain details and only show the essential features of the object. In other words, it deals with the outside view of an object (interface).
Modifiers: If you want to access a particular variable,method or class from anywhere,then make that variable accessible by using public modifier.
If you want to restrict a particular variable,method or class to be accessible outside the class,use private modifier.
Thanks
Related Pages:
encapsulation vs abstraction encapsulationvs abstraction what is the difference between encapsulation and abstraction
Encapsulation VS Abstraction - Java Beginners EncapsulationVS Abstraction Real Time sample code for Encapsulation and Abstraction. where to use abstract and where to use specifies like public private. Hi Friend,
Encapsulation-Encapsulation is a process
Difference between Encapsulation and Abstraction in Java
In this section we will discuss about the difference between Encapsulation
and Abstraction in Java. Encapsulation is a process of hiding all the data and
methods within a class from outside world. Abstraction on the other hand
Encapsulation Encapsulation
OOPs revolve around the four concepts:
1. Encapsulation
2. Polymorphism
3. Abstraction
4. Inheritance
In OOPs, these concepts are implemented through a class
encapsulation encapsulation how encapsulation is achieved?
if i write private variables in my source code, it will achieve encapsulation. this statement is true in all cases
Encapsulation in Java Encapsulation along with Inheritance, Polymorphism, and Abstraction are the four concepts of Object Oriented Programming (OOPs). Encapsulation in Java... and provides access to them by public methods.
Encapsulation is a type of data
Abstraction : Java Glossary
. Encapsulation
2. Polymorphism
3. Abstraction
4. Inheritance
In OOPs, these concepts...
Abstraction : Java Glossary
 ... creation process, programmatically.
Here we will discuss Abstraction briefly
abstraction
abstraction give a simple example program for abstraction
public class Animal
{
double energyReserves;
boolean isHungry() {
return... is an abstraction used in place of an actual animal
abstraction
abstraction give a simple example program for abstraction
 ... is an abstraction used in place of an actual animal.*/
public class Animal...);
}
}
}
/*In the above example, the class Animal is an abstraction used in place
Abstraction in flex Abstraction in flex Hi...
What keyword allows you to implement abstraction better?
please tell me about it....
Thanks
Ans:
Flex does not support abstart class directly.
Thanks
Reg:Encapsulation - Java Interview Questions
Reg:Encapsulation where we use encapsulation in programs?
how we know that is encapsulated? Hi Friend,
Encapsulation is a process... have to use the encapsulation feature.It hide the details by making the fields
Encapsulation in Java 7 Encapsulation in Java 7
This tutorial describe concept of Encapsulation. It is one of OOPs concept.
Encapsulation :
Encapsulation is a way of wrapping up data
and methods into a single unit. Encapsulation puts the data safe from
What is Abstraction - Java Beginners
What is Abstraction What is abstraction in java? How is it used in java..please give an example also Hi Friend,
Abstraction is nothing but data hiding.It involves with the dealing of essential information
Abstraction in java - Java Interview Questions Abstraction in java Abstraction in java - I know its a very basic question that i can find anywhere else as well... but i am looking for a description as well as an example on Abstraction in java. can anyone
Java abstraction - Java Beginners
Java abstraction what is abstraction in java please explain with example Hi,
Abstract Class
Abstract classes are those that works only as the parent class or the base class. Subclasses are derived to implement
websphere vs weblogic
websphere vs weblogic websphere vs weblogic
Why you are using websphere instead of weblogic
Abstraction in Java Abstraction in Java
Abstraction is one of the four pillar of OOPS Concept. Abstraction in java is a process by which hiding
the irrelevant data and exposing
only the
essential feature of object. In java Abstraction
oracle vs sql
oracle vs sql what is the difference between oracle and sql
How to make query and abstraction in Java
How to make query and abstraction in Java Hi,
I read the lessons you have in the sites. They are really useful.
However, I could not write codes... PostgreSQL database, and I want to make a query and abstraction for a table.
Could
Interface vs abstract class
Interface vs abstract class Hai,
Is there any possible to defining abstract methods in Interface
JETM vs Jprofiler
JETM vs Jprofiler Can anyone explain the difference between Java Execution Time Measurement(JETM) and Jprofiler
compiler vs interpreter
compiler vs interpreter "compiled program executes faster especially if the program contains loop" Why
Abstraction in Java 7 Abstraction in Java 7
This section elaborate about abstraction. It is one of OOPs concept.
Abstraction :
Abstraction means hiding the unnecessary...
or object.
In java, you can see concept of abstraction whenever you use
ejb vs hibernate - EJB
ejb vs hibernate 1>>> If we have ejb entity bean why we need hibernate?
2>>> Is hibernate distributed
ejbSelect() vs ejbHome() - EJB
ejbSelect vs ejbHome Hi, 1) What are the differences between ejbSelect() and ejbHome...() business methods in CMP bean? 2) In Ed Romans Mastering EJB 3rd edition, it is mentioned that ejb finder methods
Derby vs MySQL - SQL
Derby vs MySQL Hi, I want to know what are the advantages using Derby Database over MySQL. http://www.roseindia.net/eclipse/plugins/database/index.shtml
inheritence Vs inheritence
inheritence Vs inheritence what are difference b/w c++ inheritence and java inheritence
Hi Friend,
C++ supports Multiple Inheritance while Java does not.
Thanks
java vs vb
java vs vb history of java and advanced products as well as vb? compared with java and vb? finalize list out the table of java and vb products? viewers i want more soon
PHP vs J2EE, PHP vs JAVA
PHP Vs Java
Those who think that java scales and PHP not is wrong, PHP it needs someone
to explain the truth that it does scale. Those who is open minded... abstraction layer called PEAR::DB or a
thin layer on the top C data access function
ABSTRACTION AND INTERFACE - Java Interview Questions ABSTRACTION AND INTERFACE When Use Abstract?When Use Interface ?I Want Explanations?plz help me Hi Friend,
When we do not want to allow any one to create object of our class, we define the class as abstract.
When
portability vs platform independent
portability vs platform independent sir, pls tell me
1.the differences between platform independent and portability related to java technology
2.how java provides security
3.how can i prove servlet is a single instance
how to do abstraction for insurance policy being issued...
how to do abstraction for insurance policy being issued... an insurance policy is being insured.... now what will be the classes for policy and how to do abstraction of the same
OOPS Concept Abstraction with example - Java Beginners
OOPS Concept Abstraction with example I am new to java. In java OOPS concept Abstraction means abstract or something. Please explain it with one example Hi Friend,
The process of abstraction in Java is used
doGet() Vs doPost()
doGet() Vs doPost() plz explain the differences between both of these methods used in a servlet.
also give an example of both the methods.
thanks.
A doGet() method is limited with 2k of data to be sent, and doPost
PHP Comma vs Period - PHP
PHP Comma vs Period Explain PHP Comma vs Period. And also how can one show a comma within a comma separated file. Hi Friend,
Please visit the following link:
http://www.roseindia.net/tutorial/php/phpbasics/PHP
return 0 vs exit 0
return 0 vs exit 0 what is the difference between return 0 and exit 0 in c?
i could not find any difference in their behaviour (both terminates the process execution) in a program
jdk 1.6 vs jdk 1.7
jdk 1.6 vs jdk 1.7 What is the difference between jdk 1.6 and 1.7... for scripting languages.
i am talking about jdk 1.6 vs 1.7 and you have given the reply for 1.5 vs 1.6
'String' vs 'StringBuffer' - Java Beginners
'String' vs 'StringBuffer' What should i use String or StringBuffer? Hi, First you need to rectify the question. Because StringBuffers append the data, and Strings concatenate the data. Since Strings are immutable
arraylist vs vector - Java Beginners
arraylist vs vector hi, i want to know what is the difference between arraylist and vector in case of performance. in what cases we should go for arraylist and in what case we should go for vector. is there any array
Servlet vs Class - Java Beginners
Servlet vs Class I have worked on lot of projects and written number of classes myself. I have never started a project myself. Now I am assigned a task of starting a project. Could you please guide me if to start a project using
Flex SDK vs Flash Builder
Flex SDK vs Flash Builder Hi...
What is the difference Flex SDK and Flash builder?
please tell me about that....
Thanks
Ans:
Flex SDK:
Flex builder uses SDK to compile your data and create a swf. The SDK is free