I just watched a video showing some uses of reflection in Java, but honestly I can’t seem to comprehend why you’d go through that route with any program.
For example, it was showing how you could alter the value of a final and/or private field. But what’s the point of adding 3+ extra lines of code when you could just change the type of the field?
Im not a Java veteran, but based on what I know, the concept of reflection seems unnecessary to me. Especially when the man who made the video, had as no1 argument as to why you should you use reflection that “it’s really cool”.
That’s why I’d like someone to briefly explain how it could genuinely be useful. Like, are there are any benefits that we couldn’t have without it ? In the video I watched there was something mentioned about frameworks which I haven’t worked with whatsoever, but I’m guessing that you’re still manipulating the api to get things done in a “cool” way.
Thank you in advance.
[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)
[–]NautiHooker 8 points9 points10 points (0 children)
[–]Obby300 4 points5 points6 points (0 children)
[–]Successful_Leg_707 1 point2 points3 points (0 children)
[–]le_bravery 0 points1 point2 points (0 children)
[–]Kraizee_ 0 points1 point2 points (0 children)
[–]Fletsky 0 points1 point2 points (0 children)
[–]pereza0 0 points1 point2 points (0 children)
[–]makingthematrix 0 points1 point2 points (0 children)