---
title: "New Keyword — AP Comp Sci A Definition & Exam Guide"
description: "The new keyword creates an object in Java by allocating memory and calling a constructor. Learn how new, constructors, and reference variables connect on AP CSA."
canonical: "https://fiveable.me/ap-comp-sci-a/key-terms/new-keyword"
type: "key-term"
subject: "AP Computer Science A"
unit: "Unit 1"
---

# New Keyword — AP Comp Sci A Definition & Exam Guide

## Definition

In AP Computer Science A, the new keyword creates an instance of a class (an object) by allocating memory for it and calling one of the class's constructors, as in Scanner input = new Scanner(System.in); the variable then stores a reference to that new object.

## What It Is

The `new` keyword is how Java actually builds an [object](/ap-comp-sci-a/key-terms/object "fv-autolink"). Writing `Rectangle r;` only declares a reference variable, which is like an empty address label. Writing `r = new Rectangle(5, 3);` is what constructs the object. Java allocates memory for it, runs the matching [constructor](/ap-comp-sci-a/unit-1/creating-and-storing-objects/study-guide/rUOTKl6Ih5noXJ0GtxJF "fv-autolink") to initialize its instance variables, and hands back a reference (the object's address) that gets stored in `r`.

The [pattern](/ap-comp-sci-a/unit-1/why-programming-why-java/study-guide/lVK6rmrBuug17i1Hna9z "fv-autolink") is always the same: `ClassName variableName = new ClassName(arguments);`. The part after `new` is a constructor call, so the arguments you pass must match one of the class's constructors in number, order, and type. If a class has multiple constructors (constructor overloading), the arguments you give `new` decide which one runs. `new Rectangle()` runs the no-argument constructor; `new Rectangle(5, 3)` runs the two-parameter one.

## Why It Matters

[Object instantiation](/ap-comp-sci-a/key-terms/object-instantiation "fv-autolink") with `new` shows up the moment AP CSA moves from primitives to objects in [Unit 2](/ap-comp-sci-a/unit-2 "fv-autolink") (Using Objects), and it comes back when you write your own classes and constructors in Unit 5. Almost every FRQ you write will use `new` somewhere, whether you're creating a Scanner, building an ArrayList, returning a new object from a method, or filling an array with objects. If you don't understand what `new` does, the difference between a reference and an object stays fuzzy, and that confusion causes NullPointerExceptions, aliasing mistakes, and wrong answers on MCQs about object behavior.

## Connections

### Constructor (Units 2 & 5)

Every use of `new` is a constructor call. `new` allocates the memory, then the constructor fills in the [instance variables](/ap-comp-sci-a/key-terms/instance-variables "fv-autolink"). They're two halves of one action, which is why the arguments after `new` must match a constructor's parameter list exactly.

### [Reference Variable (Unit 2)](/ap-comp-sci-a/key-terms/reference-variable)

`new` returns a [reference](/ap-comp-sci-a/key-terms/reference "fv-autolink"), not the object itself. The variable on the left of the equals sign just stores that address. This is why two variables can point to the same object, and why copying a reference variable does not copy the object.

### [null (Unit 2)](/ap-comp-sci-a/key-terms/null)

A [reference variable](/ap-comp-sci-a/key-terms/reference-variable "fv-autolink") that hasn't been assigned with `new` (or is set to null) points to nothing. Calling a method on it throws a NullPointerException. `new` is exactly what moves a reference from null to a real object.

### [Constructor Overloading (Unit 5)](/ap-comp-sci-a/key-terms/constructor-overloading)

When a class has several constructors, the argument list you pass to `new` picks which one runs. `new Rectangle()` and `new Rectangle(5, 3)` create the same type of object but initialize it through different constructors.

## On the AP Exam

Multiple-choice questions love to test whether you can correctly instantiate an object, like picking the right statement to create a Scanner that reads from the keyboard (`Scanner input = new Scanner(System.in);`) or choosing which `new Rectangle(...)` call matches a given constructor in a class with overloaded constructors. Watch for trap answers that skip `new`, pass arguments in the wrong order, or use a parameter list no constructor accepts. On the free-response section, you'll use `new` constantly: instantiating objects inside methods, creating and returning new objects, and building ArrayLists with `new ArrayList<Type>()`. Forgetting `new`, or calling methods on a reference that was never assigned an object, costs points.

## New Keyword vs Declaring a reference variable

Declaring a variable (`Rectangle r;`) and creating an object (`r = new Rectangle();`) are two different steps. Declaration just makes a name that can hold a reference; until you assign it with `new`, it doesn't point to any object, and calling a method on it throws a NullPointerException. Only `new` actually constructs the object in memory.

## Key Takeaways

- The new keyword creates an object by allocating memory for it and running one of the class's constructors.
- Declaring a reference variable does not create an object; only new does, and the variable stores a reference (address) to the object, not the object itself.
- The arguments you pass after new must match a constructor's parameters in number, order, and type, and with overloaded constructors those arguments decide which constructor runs.
- Calling a method on a reference that was never assigned with new (or that is null) throws a NullPointerException.
- The standard pattern to memorize is ClassName name = new ClassName(arguments); and you'll write it in nearly every FRQ.

## FAQs

### What does the new keyword do in Java?

It creates an object. `new` allocates memory for an instance of a class, calls a constructor to initialize its instance variables, and returns a reference to the object, as in `Scanner input = new Scanner(System.in);`.

### Does declaring a variable create an object in Java?

No. `Rectangle r;` only declares a reference variable that points to nothing yet. The object doesn't exist until you write `r = new Rectangle();`. Using r before that throws a NullPointerException.

### What's the difference between new and a constructor?

They work together but aren't the same thing. The constructor is the method that initializes the object's instance variables; `new` is the keyword that allocates the memory and triggers that constructor call. You can't run a constructor in AP CSA code without `new`.

### Which constructor does new call if a class has more than one?

Java matches the arguments you pass to `new` against the constructors' parameter lists. With `public Rectangle()` and `public Rectangle(int len, int w)`, writing `new Rectangle(5, 3)` runs the two-parameter version and `new Rectangle()` runs the no-argument one.

### Is the new keyword on the AP CSA exam?

Yes, everywhere. Multiple-choice questions ask you to pick the correct instantiation statement, and almost every FRQ requires creating objects with new, like new ArrayList or a new instance of a given class.

## Related Study Guides

- [1.13 Creating and Storing Objects](/ap-comp-sci-a/unit-1/creating-and-storing-objects/study-guide/rUOTKl6Ih5noXJ0GtxJF)

## Structured Data

```json
{"@context":"https://schema.org","@graph":[{"@type":"LearningResource","@id":"https://fiveable.me/ap-comp-sci-a/key-terms/new-keyword#resource","name":"New Keyword — AP Comp Sci A Definition & Exam Guide","url":"https://fiveable.me/ap-comp-sci-a/key-terms/new-keyword","learningResourceType":"Concept explainer","educationalLevel":"AP® / High School","about":{"@id":"https://fiveable.me/ap-comp-sci-a/key-terms/new-keyword#term"},"audience":{"@type":"EducationalAudience","educationalRole":"student"},"dateModified":"2026-06-11T00:50:33.113Z","isPartOf":{"@type":"Collection","name":"AP Computer Science A Key Terms","url":"https://fiveable.me/ap-comp-sci-a/key-terms"},"publisher":{"@type":"Organization","name":"Fiveable","url":"https://fiveable.me"}},{"@type":"DefinedTerm","@id":"https://fiveable.me/ap-comp-sci-a/key-terms/new-keyword#term","name":"New Keyword","description":"In AP Computer Science A, the new keyword creates an instance of a class (an object) by allocating memory for it and calling one of the class's constructors, as in Scanner input = new Scanner(System.in); the variable then stores a reference to that new object.","url":"https://fiveable.me/ap-comp-sci-a/key-terms/new-keyword","inDefinedTermSet":{"@type":"DefinedTermSet","name":"AP Computer Science A Key Terms","url":"https://fiveable.me/ap-comp-sci-a/key-terms"}},{"@type":"FAQPage","mainEntity":[{"@type":"Question","name":"What does the new keyword do in Java?","acceptedAnswer":{"@type":"Answer","text":"It creates an object. `new` allocates memory for an instance of a class, calls a constructor to initialize its instance variables, and returns a reference to the object, as in `Scanner input = new Scanner(System.in);`."}},{"@type":"Question","name":"Does declaring a variable create an object in Java?","acceptedAnswer":{"@type":"Answer","text":"No. `Rectangle r;` only declares a reference variable that points to nothing yet. The object doesn't exist until you write `r = new Rectangle();`. Using r before that throws a NullPointerException."}},{"@type":"Question","name":"What's the difference between new and a constructor?","acceptedAnswer":{"@type":"Answer","text":"They work together but aren't the same thing. The constructor is the method that initializes the object's instance variables; `new` is the keyword that allocates the memory and triggers that constructor call. You can't run a constructor in AP CSA code without `new`."}},{"@type":"Question","name":"Which constructor does new call if a class has more than one?","acceptedAnswer":{"@type":"Answer","text":"Java matches the arguments you pass to `new` against the constructors' parameter lists. With `public Rectangle()` and `public Rectangle(int len, int w)`, writing `new Rectangle(5, 3)` runs the two-parameter version and `new Rectangle()` runs the no-argument one."}},{"@type":"Question","name":"Is the new keyword on the AP CSA exam?","acceptedAnswer":{"@type":"Answer","text":"Yes, everywhere. Multiple-choice questions ask you to pick the correct instantiation statement, and almost every FRQ requires creating objects with new, like new ArrayList or a new instance of a given class."}}]},{"@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"AP Computer Science A","item":"https://fiveable.me/ap-comp-sci-a"},{"@type":"ListItem","position":2,"name":"Key Terms","item":"https://fiveable.me/ap-comp-sci-a/key-terms"},{"@type":"ListItem","position":3,"name":"Unit 1","item":"https://fiveable.me/ap-comp-sci-a/unit-1"},{"@type":"ListItem","position":4,"name":"New Keyword"}]}]}
```
