-2

I need explanation for the below questions:

  • What is reflection in java?
  • In which situation i need to use reflection?
  • Real time scenarios and examples for the need of using reflection?

I am very confused in reflection. I had read a lot of documents but I am still confused. Please give me a explanation where I can understand it completely.

Grodriguez
22.1k11 gold badges72 silver badges118 bronze badges
asked Dec 4, 2013 at 8:55
2
  • These questions are very well google-able! Please be more specific, we are not supposed to be teachers. Commented Dec 4, 2013 at 9:44
  • 1
    Make a disguise and I can go to your class for you so you don't even need to do that. Commented Dec 4, 2013 at 9:50

1 Answer 1

5
what is reflection in java?

Reflection makes it possible to inspect classes, interfaces, fields and methods at runtime, without knowing the names of the classes, methods etc. at compile time. It is also possible to instantiate new objects, invoke methods and get/set field values using reflection.

In which situation i need to use reflection? 

mapping objects to tables in a database at runtime.

Real time scenarios and examples for the need of using reflection? 

Good Real time example is MyEclipse IDE. if you put your mouse pointer over any class name it reflect the class name and with some information. This is also one type of reflection using reflection api.

Go through this Reflction API link you can get some more info.

answered Dec 4, 2013 at 9:05
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.