How to stop execution of java

For example

public void fun1()

{

// some java code here part 1

func2();

//some java code here part 2

}

publixc void func2()

{

// I want a code here which will die the further exectuion of java code of this function and func1()'s part 2 [Simiar to die(); of PHP)

//some java code here...

}

[362 byte] By [dkppa] at [2007-11-27 5:35:15]
# 1
System.exit(<an int that is returned to the OS>);
georgemca at 2007-7-12 15:04:08 > top of Java-index,Java Essentials,Java Programming...
# 2

System.exit ?

Not entirely sure what you want. That's pretty permanent.

Another option is something like this.

public void func1(){

if(!func1){

return;

}

}

public boolean func2(){

// something untoward happens

return false;

}

or maybe you want exceptions

public void func1()throws Exception{

funcd1();

}

public void func2()throws Exception{

throw new Exception("Ay caramba!");

}

cotton.ma at 2007-7-12 15:04:08 > top of Java-index,Java Essentials,Java Programming...
# 3
Actually you probably want Exceptions.See this http://java.sun.com/docs/books/tutorial/essential/exceptions/index.html
cotton.ma at 2007-7-12 15:04:08 > top of Java-index,Java Essentials,Java Programming...