You are here: Home / Topics / Exit() function example in Java

Exit() function example in Java

Filed under: Java on 2023-08-11 19:21:52

// Program to use exit() function

class ExitTest
{
public static void main( String args[] )
{
 int a = 10;
 System.out.println( "AAA" );
 if( a == 10 )
  System.exit(0);
 System.out.println( "BBB" );
}
}

Output:

AAA

About Author:
V
Vinay Kumar     View Profile
Hi, I am using MCQ Buddy. I love to share content on this website.