可能是个愚蠢的问题,但我该如何将null
传递给接受long
或int
的方法?
示例:
TestClass{
public void iTakeLong(long id);
public void iTakeInt(int id);
}
现在我该如何将null传递给这两个方法:
TestClass testClass = new TestClass();
testClass.iTakeLong(null); // Compilation error : expected long, got null
testClass.iTakeInt(null); // Compilation error : expected int, got null
有什么想法和建议吗?