๐Ÿšจ Limited Offer: First 50 users get 500 credits for free โ€” only ... spots left!
AP Computer Science A Flashcards

Free flashcards to ace your AP - AP Computer Science A

Learn faster with 49 AP flashcards. One-click export to Notion.

Learn fast, memorize everything and ace your AP. No credit card required.

Want to create flashcards from your own textbooks and notes?

Let AI create automatically flashcards from your own textbooks and notes. Upload your PDF, select the pages you want to memorize fast, and let AI do the rest. One-click export to Notion.

Create Flashcards from my PDFs

AP Computer Science A

49 flashcards

An object is an instance of a class. It has state (data fields) and behavior (methods).
Inheritance is a mechanism where a new class is derived from an existing class, inheriting its data and behaviors. This supports code reusability.
The four main principles are encapsulation, abstraction, inheritance, and polymorphism.
An abstract class can have both abstract and non-abstract (concrete) methods, while an interface can only have abstract methods. A class can extend only one abstract class but can implement multiple interfaces.
Polymorphism allows an object to take on many forms. It occurs when a parent class reference is used to refer to a child class object.
The 'final' keyword is used to make a variable, method, or class immutable (unchangeable). Final variables must be initialized, final methods cannot be overridden, and final classes cannot be extended.
The '==' operator compares the reference of objects, while the 'equals()' method compares the content or value of objects.
A constructor is a special method used to initialize objects. It has the same name as the class and no return type.
An ArrayList is an index-based data structure that stores elements in contiguous memory locations. A LinkedList is a node-based data structure where elements are linked using pointers.
The 'super' keyword is used to call the parent class constructor or access parent class members from the child class.
An exception is an event that disrupts the normal flow of a program's instructions. It is used to handle errors or exceptional situations.
The 'synchronized' keyword is used to control access to shared resources by allowing only one thread to execute a block of code at a time, preventing race conditions.
A static method belongs to the class itself, while a non-static method belongs to an instance of the class. Static methods can be called without creating an object.
The 'this' keyword refers to the current instance of the class and is used to access or invoke the current object's members (fields and methods).
Private members are only accessible within the same class. Protected members are accessible within the same class, subclasses, and the same package. Public members are accessible from anywhere.
An abstract class can have both abstract and non-abstract (concrete) methods, while an interface can only have abstract methods. A class can extend only one abstract class but can implement multiple interfaces.
The 'static' keyword is used to define class members (fields and methods) that belong to the class itself, rather than to instances of the class.
The 'break' statement terminates the entire loop, while the 'continue' statement skips the current iteration and moves to the next iteration of the loop.
The 'instanceof' operator is used to check whether an object is an instance of a particular class or an instance of a class that inherits from that class.
A HashSet stores elements in a hash table, providing constant-time performance for basic operations. A TreeSet stores elements in a red-black tree, maintaining the elements in sorted order.
The 'charAt()' method returns the character at the specified index position in a string.
Both are mutable string classes, but StringBuffer is thread-safe, while StringBuilder is not thread-safe but faster.
The 'compareTo()' method is used to compare two objects for order. It returns a negative integer, zero, or a positive integer based on whether the object is less than, equal to, or greater than the specified object.
When applied to a variable, the 'final' keyword makes the variable constant, meaning its value cannot be changed after it is initialized.
The 'try-catch' block is used for exception handling. The 'try' block contains the code that might throw an exception, and the 'catch' block handles the exception if it occurs.
The 'finally' block is used in conjunction with the 'try-catch' block and contains code that will be executed regardless of whether an exception is thrown or not.
Both are implementations of the Map interface, but Hashtable is synchronized (thread-safe) while HashMap is not. Hashtable also does not allow null keys or values, while HashMap allows one null key and any number of null values.
The 'toString()' method is used to get a string representation of an object. It is often overridden in classes to provide a more meaningful representation of the object's state.
The 'equals()' method is used to compare two objects for equality. It is often overridden in classes to provide a custom implementation of equality comparison based on the object's state.
The 'hashCode()' method is used to get a hash code value for an object, which is typically used in hash-based data structures like HashMap and HashSet. It is often overridden in classes to provide a custom implementation of hash code calculation based on the object's state.
The 'clone()' method is used to create a copy of an object. It is part of the 'Cloneable' interface, and classes that implement this interface must provide a custom implementation of the 'clone()' method.
When applied to a method, the 'static' keyword means that the method belongs to the class itself, rather than to instances of the class. Static methods can be called without creating an object of the class.
The 'volatile' keyword is used to ensure that the value of a variable is read from and written to main memory, rather than being cached in a thread's local cache. This is useful for maintaining visibility of shared variables across threads.
The 'transient' keyword is used to mark fields that should not be serialized when an object is persisted to a stream or file. It is often used for fields that contain temporary data or resources that should not be part of the object's persistent state.
The 'package' keyword is used to define the package to which a class, interface, or other type belongs. It is a way of organizing and grouping related types in Java.
The 'import' statement is used to include classes, interfaces, or other types from external packages into the current source file, allowing them to be used without specifying their full package names.
The 'assert' keyword is used for defensive programming and debugging. It allows you to define a boolean expression that should always be true, and if the expression is false, it throws an AssertionError.
A 'private' member is only accessible within the same class, while a 'default' (package-private) member is accessible within the same class and the same package, but not outside the package.
The 'byte' data type is an 8-bit signed integer data type in Java, used to save memory when storing small integer values within a limited range (-128 to 127).
The stack is used for storing method calls and local variables, and follows a last-in-first-out (LIFO) order. The heap is used for dynamically allocating objects and follows a more complex memory management system.
The 'finalize()' method is a special method in Java that is called by the garbage collector before an object is garbage collected. It is intended to clean up resources held by the object, like closing files or network connections.
Threads are a way to achieve concurrency in Java, allowing multiple tasks or computations to be executed simultaneously within a single process. This can improve performance and responsiveness of applications.
The 'wait()' and 'notify()' methods are used for inter-thread communication and synchronization. 'wait()' pauses the execution of a thread until it is notified, and 'notify()' is used to wake up a thread that is waiting.
The 'Iterator' interface provides a way to access and traverse the elements of a collection (like ArrayList or HashSet) in a sequential manner, without exposing the underlying implementation details.
Lambda expressions are a concise way to represent anonymous functions or method implementations in Java. They are used extensively with functional programming concepts and can make code more readable and compact.
The Stream API is a feature introduced in Java 8 that provides a functional-style approach to processing collections of data. It allows developers to perform operations like filtering, mapping, and reducing on data streams in a declarative and efficient manner.
The Garbage Collector is an automatic memory management mechanism in Java that periodically frees up memory occupied by objects that are no longer in use by the application, preventing memory leaks and freeing up system resources.
The ClassLoader is a part of the Java Runtime Environment (JRE) that is responsible for loading class files from various sources (like file systems, network, or databases) and making them available to the Java Virtual Machine (JVM) for execution.
The Reflection API in Java allows developers to inspect and manipulate classes, interfaces, fields, and methods at runtime, providing the ability to create dynamic and flexible applications that can modify their behavior based on runtime conditions.