File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes core java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "core java" Watch "core java" New topic

core java

Hari Prasad M

Joined: Feb 27, 2006
Posts: 3
what is encapsulation ? real time example ?

where we use reflection ? which situation ?

Hari Prasad Mallidi
marc weber

Joined: Aug 31, 2004
Posts: 11343

Check the index of any core Java book.

"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
ak pillai
Ranch Hand

Joined: Feb 11, 2006
Posts: 288
what is encapsulation ? real time example ?

Being able to encapsulate members of a class is important for security and integrity. We can protect variables from unacceptable values. The sample code below describes how encapsulation can be used to protect the MyMarks object from having negative values. Any modification to member variable �vmarks� can only be carried out through the setter method setMarks(int mark). This prevents the object �MyMarks� from having any negative values by throwing an exception.

Reflection is used when you have to introspect a class and its memebers to do stuff dynamically. This is used by lot of application frameworks like Hibernate etc, java based editors, etc. Code with intrspection can adversely affect performance proper caching strategy should be implemented.

java j2ee job interview questions with answers | Learn the core concepts and the key areas
I agree. Here's the link:
subject: core java
It's not a secret anymore!