java close app code example Example 1: java close application System.exit(0); Example 2: java quit application System.exit(n);