---
title: "Truncation — AP Computer Science A Definition & Examples"
description: "Truncation chops off the decimal part of a number without rounding, which is why 7/2 equals 3 in Java. Essential for int division and casting in AP CSA Unit 1."
canonical: "https://fiveable.me/ap-comp-sci-a/key-terms/truncation"
type: "key-term"
subject: "AP Computer Science A"
---

# Truncation — AP Computer Science A Definition & Examples

## Definition

Truncation refers to the process of removing a portion of data from the end.

## Review

### Related Terms

- [Substring](/ap-comp-sci-a/key-terms/substring): Substring refers to a smaller part or section of a larger string.
- Slicing: Slicing is similar to truncation, where only a specific portion or range of data is extracted from a larger dataset.
- Cropping: Cropping is commonly associated with images and involves removing unwanted parts from the edges.
