NoteFren home

Flashcard library · AP Computer Science

AP Computer Science: Java Basics

This flashcard deck covers the fundamental Java concepts essential for success in AP Computer Science A. It focuses on the most frequently tested material, including basic syntax, data types, control structures, methods, and core object-oriented programming principles. Use these cards to reinforce your understanding and prepare thoroughly for the exam.

Want to actually learn these?

Save this deck to your NoteFren library and study it with spaced repetition — or turn your own notes into cards like these.

What are the two categories of Java data types?

Primitive types (int, double, boolean) and reference types (String, arrays, objects).

Which primitive types does AP Computer Science A test?

int, double and boolean.

How does == differ from .equals() for objects?

== checks whether two references point to the same object; .equals() compares content when overridden.

What does the main method do?

It is the entry point where the program starts running.

How do you declare an int named age with value 30?

int age = 30;

What is an if–else if–else chain for?

Running different code depending on which condition is true first.

When is a for loop the natural choice?

When the number of iterations is known, with a counter to initialize, test and update.

When is a while loop the natural choice?

When iteration continues until a condition changes and the count is not known in advance.

What is a class?

A blueprint defining the instance variables and methods of its objects.

What is an object?

An instance of a class, with its own state.

How do you create a Dog object?

Dog myDog = new Dog();

What is a constructor?

A method-like block with the class's name and no return type that initializes new objects.

How do you create an int array of length 5?

int[] numbers = new int[5];

What does System.out.println() do?

Prints its argument followed by a new line.

What makes up a method signature?

The method name and the number, types and order of its parameters — not the return type.