Check if a type is an interface

后端 未结 3 1057
灰色年华
灰色年华 2021-01-11 14:57

I want to validate a parameter sent to a method, it must be an interface type. What to ask?

void (Class interfaceType){
  if (thisisnotaninterface){         


        
3条回答
  •  隐瞒了意图╮
    2021-01-11 15:27

    Just use Class#isInterface() to check that

    And seriously, you should be reading the Javadocs before asking here.

提交回复
热议问题