Solved

junit java reflection

Posted on 2014-07-17
6
891 Views
Last Modified: 2014-07-27
Hi,

What is the relation between

junit java reflection

I have not clearly understood what and why java reflection is useful. Is java reflection is new from jdk7?
Please advise with simple complete examples?
0
Comment
Question by:gudii9
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 14

Accepted Solution

by:
CPColin earned 250 total points
ID: 40203043
I have not clearly understood what and why java reflection is useful. Is java reflection is new from jdk7?

You've asked these questions before:

http://www.experts-exchange.com/Programming/Languages/Java/Q_28375199.html

The answers are still the same.

Do you have a more specific question or situation in mind? I expect that JUnit uses reflection so it can work with whatever code you throw at it, without having to know how your code is structured.
0
 
LVL 27

Assisted Solution

by:dpearson
dpearson earned 250 total points
ID: 40203910
Reflection is not new.

It is very rarely needed.  It's only used in complex situations where you need to gather information about a program that for some reason the compiler cannot provide.

E.g. You could write a program where you type in the name of a method and have the program execute that method.
That's a pretty unusual situation.

I'd suggest you avoid it for now unless you have a specific problem in mind that you cannot solve.

Doug
0
 
LVL 7

Author Comment

by:gudii9
ID: 40218017
I see some architects keep talking about it quite a lot in my project. I wonder if they know lot of technology or they are trying to use it unnecessarily
0
Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

 
LVL 14

Expert Comment

by:CPColin
ID: 40218028
The easiest way to find out is to ask them. You could tell them you're interested in learning more about reflection and ask them to give you an overview of what they're working on.
0
 
LVL 7

Author Comment

by:gudii9
ID: 40218029
I expect that JUnit uses reflection so it can work with whatever code you throw at it, without having to know how your code is structured.

Structured meaning which method comes after which method like flow? or what is written inside the method curly braces{}
Please advise
0
 
LVL 14

Expert Comment

by:CPColin
ID: 40218051
JUnit needs to work with whatever class you throw at it, without knowing what fields and methods it has ahead of time. That's what I meant by "how your code is structured."
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question