में अपवाद का प्रचार कैसे करें मैं एक सी प्रोग्रामर हूं और हाल ही में कुछ जावा सीख रहा हूं क्योंकि मैं एक एंड्रॉइड एप्लिकेशन विकसित कर रहा हूं। वर्तमान में मैं एक परिस्थिति में हूं। एक है निम्नलिखित है।जावा
public Class ClassA{
public ClassA();
public void MyMethod(){
try{
//Some code here which can throw exceptions
}
catch(ExceptionType1 Excp1){
//Here I want to show one alert Dialog box for the exception occured for the user.
//but I am not able to show dialog in this context. So I want to propagate it
//to the caller of this method.
}
catch(ExceptionType2 Excp2){
//Here I want to show one alert Dialog box for the exception occured for the user.
//but I am not able to show dialog in this context. So I want to propagate it
//to the caller of this method.
}
}
}
अब मैं किसी अन्य वर्ग में कहीं और विधि MyMethod() को कॉल करने के लिए उपयोग करना चाहता हूं। अगर कोई मुझे कुछ कोड स्निपेट प्रदान कर सकता है तो MyMethod() के कॉलर को अपवादों का प्रचार कैसे करें ताकि मैं उन्हें कॉलर विधि में एक संवाद बॉक्स में प्रदर्शित कर सकूं।
क्षमा करें अगर मैं इस प्रश्न पूछने के तरीके में इतना स्पष्ट और अजीब नहीं हूं।
यह भी देखें http://stackoverflow.com/questions/409563/best-prac tices के लिए अपवाद प्रबंधन में जावा या सी तेज – mglauche