Class
A blueprint for creating objects that defines its attributes and behaviors Example: public class Song { String title; String artist; }
Object
An instance of a class containing data and methods Example: Song mySong = new Song();
Instance Variable
A variable defined in a class for which each instantiated object has its own copy Example: public class Song { String title; String artist; double cost; }
Constructor
A special method used to initialize objects when a new instance of a class is created Example: public Song(String title, String artist, double cost) { this.title = title; this.artist = artist; this.cost = cost; }
Zero
Argument Constructor
Multi
Argument Constructor
Method
A function defined within a class that describes the behaviors of an object Example: public void play() { System.out.println("Playing " + title); }
toString() Method
A method that returns a string representation of an object's state Example: public String toString() { return "Title: " + title + ", Artist: " + artist; }
Driver Class
A separate class used to test and run methods from another class Example: public class SongDriver { public static void main(String[] args) { Song mySong = new Song(); System.out.println(mySong); } }
Array
A data structure that holds multiple values of the same type in a single variable Example: int[] scores = new int[10];
For Loop
A control flow statement used to iterate over a range of values or elements in a collection Example: for (int i = 0; i < scores.length; i++) { System.out.println(scores[i]); }
Scanner Class
A Java class used for reading input from the user, such as integers, strings, or doubles Example: Scanner scanner = new Scanner(System.in); String name = scanner.nextLine();
Boolean
A data type that represents one of two values: true or false Example: boolean isOn = true;
String
A data type in Java used to store a sequence of characters Example: String message = "Hello, World!";
Encapsulation
The concept of bundling data (attributes) and methods (functions) that operate on the data within a single unit or class Example: public class Account { private double balance; public double getBalance() { return balance; } }
Array of Objects
An array where each element is an instance of a class Example: Song[] playlist = new Song[5];
Default Values
Initial values assigned to variables when no specific value is provided (e.g., 0 for integers, empty string for strings) Example: public Clock() { int hour = 0; String timeZone = ""; }
User Input Validation
The process of checking if the input provided by the user meets certain criteria before processing it Example: if (username.equals("admin")) { System.out.println("Welcome!"); } else { System.out.println("Invalid username"); }
Error Handling
Techniques used to manage and respond to runtime errors in a program Example: try { int number = Integer.parseInt(input); } catch (NumberFormatException e) { System.out.println("Invalid number!"); }
Loop Counter
A variable used to control the number of iterations in a loop Example: for (int i = 0; i < 5; i++) { System.out.println(i); }
Nested Loops
A loop inside another loop, used for multi
Conditionals (If Statements)
A control structure that allows executing certain code blocks based on specific conditions Example: if (age >= 18) { System.out.println("You are an adult."); }
Class Design
The process of defining the structure, methods, and attributes of a class Example: public class Book { private String title; private String author; public String getTitle() { return title; } }
Data Types
Different kinds of data that can be used in a program (e.g., int, double, boolean, String) Example: int age = 20; double price = 19.99; boolean isAvailable = true;
Blackjack Card Game
A game concept used to demonstrate object creation, arrays, and methods Example: public class Card { String suit; int value; public Card(String suit, int value) { this.suit = suit; this.value = value; } }