3 ms·
Does Java have something similar to .Net's reflection?
by TeHCrAzY 16y ago
Does Java have something similar to .Net's reflection?
- jackowayed 16y agoI'm not sure how .NET's reflection works, but it does have reflection, where you can say stuff like "tell me all of String's methods" and for each of those you can find out public vs private vs protected, final vs not, etc. See http://download-llnw.oracle.com/javase/1.3/docs/api/java/lang/reflect/package-summary.html http://download-llnw.oracle.com/javase/1.3/docs/api/java/lan...
- TeHCrAzY 16y agoIt looks very similar, albeit a bit tidier than .net's implementation.
- wmf 16y agoConsidering the history, don't you mean "Does .NET have something similar to Java's reflection?"
- TeHCrAzY 16y agoNo, if I meant that, I would have written that. I know much about .net, and not a great deal about java.
- JeremyBanks 16y agoI don't understand the up-votes on this. He asked a reasonable question and phrased it with respect to his knowledge base. Your reply assumes he knows the answer to the question he's asking. Huh?
- wmf 16y agoMy comment was a joke. (Which I thought appropriate given the root of this thread.)
- MartinCron 16y agoAs a (mostly) .Net developer, I was curious, so I looked it up. Yes, you can use reflection in Java to invoke private methods and access private fields in much the same way you can in .Net
- rbanffy 16y agoOr... Did the .NET/C# folks copy the reflection from Java or invented it themselves?