How to get the class of type variable in Java Generics

前端 未结 7 1698
北恋
北恋 2021-02-01 17:24

I\'ve seen similar questions but they didnt help very much.

For instance I\'ve got this Generic Class:

public class ContainerTest
{

    public          


        
7条回答
  •  忘掉有多难
    2021-02-01 18:07

    If You can define like this

    public class ContainerTest
    {
    
        public void doSomething(T clazz)
        {
    
        }
    }
    

    Then it is possible

提交回复
热议问题