lundi 2 février 2015

When check if method true, the method is called again?


Vote count:

0




Ok so in my program I have two classes, LinkPhone.java, and Frame.java. In the LinkPhone part it calls a function to determine if it is true, and then if it is do something. But then I call the function and use an If statement to check it, it recalls the statement from the If statement. Like in the console it says "DEBUG: Frame init success" twice. Why does it call the function twice and how would I fix it?


LinkPhone.java:



Frame.initFrame();
if(Frame.initFrame() == true){
return;
} else {
return;
}


Frame.java:



public static boolean initFrame(){
try {
JFrame frame = new JFrame("Link Phone");
System.out.println("DEBUG: Frame init success");
return true;
} catch (Exception e) {
System.out.println("DEBUG: Frame init failed!!!");
return false;
}
}




asked 32 secs ago







When check if method true, the method is called again?

Aucun commentaire:

Enregistrer un commentaire