---
spec: JLS
title: "The Java Language Specification"
edition: "Java SE 10 Edition"
java_version: 10
chapter: "Chapter 12. Execution"
section: "12.8"
heading: "12.8. Program Exit"
parent: "Chapter 12. Execution"
source: https://docs.oracle.com/javase/specs/jls/se10/html/jls-12.html#jls-12.8
id: "12.8"
url: https://jvm.obfuscated.software/jls/se10/12.8.html
raw: https://jvm.obfuscated.software/jls/se10/12.8.md
---

# 12.8. Program Exit

A program terminates all its activity and *exits* when one of two things happens:

- All the threads that are not daemon threads terminate.
- Some thread invokes the `exit` method of class `Runtime` or class `System`, and the `exit` operation is not forbidden by the security manager.
