बेवकूफ सवाल हो सकता है, लेकिन मैं null
को long
या int
पर ले जाने के तरीके को कैसे पास कर सकता हूं?लंबी या int की अपेक्षा करने वाली विधि को कैसे पास किया जाए?
उदाहरण:
TestClass{
public void iTakeLong(long id);
public void iTakeInt(int id);
}
अब मैं कैसे दोनों methos को अशक्त पारित कर सकते हैं:
TestClass testClass = new TestClass();
testClass.iTakeLong(null); // Compilation error : expected long, got null
testClass.iTakeInt(null); // Compilation error : expected int, got null
विचार, सुझाव?
आप इस तरह के एक विधि के लिए nulls पारित करने के लिए क्यों चाहते हैं? आप यह क्या करने की उम्मीद करते हैं? –