Click here to Skip to main content
15,908,906 members
Home / Discussions / Java
   

Java

 
Questioninteracting with parent Pin
JR2122-Aug-12 7:11
JR2122-Aug-12 7:11 
AnswerRe: interacting with parent Pin
Nagy Vilmos2-Aug-12 20:40
professionalNagy Vilmos2-Aug-12 20:40 
GeneralRe: interacting with parent Pin
JR2122-Aug-12 21:09
JR2122-Aug-12 21:09 
GeneralRe: interacting with parent Pin
Nagy Vilmos2-Aug-12 21:19
professionalNagy Vilmos2-Aug-12 21:19 
QuestionI want help Pin
Mohammed Kherfan1-Aug-12 22:47
Mohammed Kherfan1-Aug-12 22:47 
AnswerRe: I want help Pin
Andrei Straut1-Aug-12 23:03
Andrei Straut1-Aug-12 23:03 
QuestionThorwing Exception to the calling function from other class Pin
muhammed_k31-Jul-12 23:00
muhammed_k31-Jul-12 23:00 
GeneralRe: Throwing Exception to the calling function from other class Pin
Andrei Straut31-Jul-12 23:38
Andrei Straut31-Jul-12 23:38 
If the error code generated by method A on exception is unique (meaning that no normal output from A will ever match that error code), you can simply do this (assuming that error code returned on exception is -1):

Java
if(ca.A() == -1) {
    //Do stuff when exception occurred
}


Conversely, if you have access to the sources and you are allowed to modify them, don't catch the exception. Modify the CA.A() method signature and add throws ExceptionThrownFromCA (just an example). Like this, you don't even need to check the error code, and you can do this:

Java
public void B() {
    CA ca = new CA();

    try {
        ca.A();
    } catch(ExceptionThrownFromCA e) {
        //Do your stuff
    }
}

Full-fledged Java/.NET lover, full-fledged PHP hater.
Full-fledged Google/Microsoft lover, full-fledged Apple hater.
Full-fledged Skype lover, full-fledged YM hater.


modified 1-Aug-12 10:07am.

AnswerRe: Thorwing Exception to the calling function from other class Pin
Nagy Vilmos1-Aug-12 20:08
professionalNagy Vilmos1-Aug-12 20:08 
GeneralRe: Thorwing Exception to the calling function from other class Pin
muhammed_k2-Aug-12 6:43
muhammed_k2-Aug-12 6:43 
GeneralRe: Thorwing Exception to the calling function from other class Pin
Nagy Vilmos2-Aug-12 20:23
professionalNagy Vilmos2-Aug-12 20:23 
GeneralRe: Thorwing Exception to the calling function from other class Pin
muhammed_k2-Aug-12 21:19
muhammed_k2-Aug-12 21:19 
GeneralRe: Thorwing Exception to the calling function from other class Pin
Nagy Vilmos2-Aug-12 21:48
professionalNagy Vilmos2-Aug-12 21:48 
GeneralRe: Thorwing Exception to the calling function from other class Pin
muhammed_k2-Aug-12 21:55
muhammed_k2-Aug-12 21:55 
Questionaccess data stored in hashset java Pin
ahmadiss31-Jul-12 1:56
ahmadiss31-Jul-12 1:56 
Questionerror when run project jsf2.0 Pin
ahmadiss30-Jul-12 7:14
ahmadiss30-Jul-12 7:14 
AnswerRe: error when run project jsf2.0 Pin
Nagy Vilmos30-Jul-12 23:50
professionalNagy Vilmos30-Jul-12 23:50 
QuestionDesigning to interfaces? Pin
Neo1010129-Jul-12 9:52
Neo1010129-Jul-12 9:52 
AnswerRe: Designing to interfaces? Pin
BobJanova29-Jul-12 23:01
BobJanova29-Jul-12 23:01 
GeneralRe: Designing to interfaces? Pin
Neo1010129-Jul-12 23:48
Neo1010129-Jul-12 23:48 
GeneralRe: Designing to interfaces? Pin
BobJanova30-Jul-12 0:13
BobJanova30-Jul-12 0:13 
AnswerRe: Designing to interfaces? Pin
jschell30-Jul-12 5:54
jschell30-Jul-12 5:54 
Questionhow to convert java code to c# code Pin
LAPEC25-Jul-12 12:55
LAPEC25-Jul-12 12:55 
AnswerRe: how to convert java code to c# code Pin
Paul Conrad25-Jul-12 17:02
professionalPaul Conrad25-Jul-12 17:02 
GeneralRe: how to convert java code to c# code Pin
jschell27-Jul-12 12:04
jschell27-Jul-12 12:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.