Real Time sample code for Encapsulation and Abstraction.
where to use abstract and where to use specifies like
public private.
Answers were Sorted based on User's Feedback
Answer / ravikiran
Encapsulation & Abstraction:
The private variable declaration is abstration,and making
usage of getters and setters is encapsulation
private String name="";
private String school="";
public String getName()
{
return name;
}
public void setName(String name)
{
this.name=name;
}
When We use private when we want to restrict the access
within the class.
When we use public then the variable or method will be
accessible in all the locations
| Is This Answer Correct ? | 18 Yes | 1 No |
Answer / manikandan [ gtec,vellore ]
Encapsulation is used when v need to use a data with the
object access.
Abstraction is used when v need to restrict the end user to
access all process.
| Is This Answer Correct ? | 1 Yes | 10 No |
Why is multiple inheritance not supported in java?
what do you mean by stream pipelining in java 8? Explain
How can you read an integer value from the keyword when the application is runtime in java? example?
when,where and how to use abstract class and interface
what is the difference between preemptive scheduling and time slicing? : Java thread
who was the founder of java
32 Answers CTS, HCL, ProKarma,
What is a default constructor and also define copy contrucyor?
explain autoboxing in java?
Is array size fixed in java?
Name the methods in mouse listeners ?
What is garbage collector?
Why are functions called methods in java?