Answer the question
In order to leave comments, you need to log in
Why use a similar notation in java?
Sometimes in the code you can find a similar entry
foo (NameClass.class);
What is it for and how to use it?
Answer the question
In order to leave comments, you need to log in
With the help , a Class.class
object is obtained , so that in the future, through reflection, it would be possible to perish properties at runtime.
https://www.youtube.com/watch?v=FfLRFWKUYLU&list=P...
Watch from the 32nd minute.
This is an example of using the Reflection API. One of the ways to achieve greater flexibility in the behavior of the program at runtime. In this case, you are passing the class itself. The method signature looks like void foo(Class c) {}. In this case, you do not need to create an instance of the class. The method itself will determine the method and necessity of creating an instance of this class.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question