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 |
What is method Overloading in the perspective of OOPS?
Can we override data members in java?
What is method and methodology?
What do you mean by thread safe?
write a program to create an arraylist with string(add,remove) operation.and value should be enter through keyboard.
Give any two differences between C++ and java.
Which is the best way to use for String concatenation in Java?
Same common question what is Map,Set,HashMap,List????
What is yielding and sleeping? how they different?
What is the benefit of inner / nested classes ?
Can we use different return types for methods when overridden?
Is arraylist dynamic in java?