This repository contains all lecture materials and code examples used in the Java Refresher session for the Data Structures Lab. The purpose of this module is to ensure that students have a solid and practical foundation in Java before moving into advanced Data Structures topics such as Linked Lists, Stacks, Queues, Trees, and Recursion.
This module is concise, example-driven, and focuses only on features directly required for the course.
This refresher provides a structured review of the Java concepts most relevant to implementing data structures:
- Variables, data types, operators
- Control structures: if-else, loops, switch
- Input/output, method creation, static vs instance methods
- 1D and 2D arrays
- Common array operations
- String immutability, basic manipulation
- Understanding memory behavior for arrays (important for DS)
- Class structure
- Constructors
- Attributes & methods
- Access modifiers (public, private, protected)
- Encapsulation
- Inheritance
- Polymorphism (method overriding & dynamic dispatch)
- Interface creation and implementation
- Why interfaces matter in data structures (e.g., Comparable, Iterable)
- Generic classes (e.g., Node, Pair<T, U>)
- Generic methods
- Type safety and compile-time checking
- try–catch
- checked vs unchecked exceptions
- custom exceptions
- error handling in DS implementations
All examples are short, focused, and tied directly to concepts used later in Data Structures.
java-ds-lab-refresher/
│
├── basics/
│ └── BasicsDemo.java
│
├── arrays-strings/
│ └── ArrayStringDemo.java
│
├── oop/
│ ├── Student.java
│ ├── Shape.java
│ ├── Circle.java
│ ├── Square.java
│ └── PrintableDemo.java
│
├── generics/
│ ├── Pair.java
│ └── GenericMethods.java
│
└── exceptions/
└── ExceptionDemo.javaEach folder contains clean, minimal code examples aligned with topics covered in the refresher session.
By the end of this module, students should be able to:
- Understand how Java stores and manages data
- Write and use classes that represent simple data structures
- Work with generics and create typed structures (e.g., Node)
- Read and write code that uses interfaces
- Trace execution for array operations
- Use exceptions properly in Java programs
- Study and prepare for pointer-based structures such as linked lists
This refresher ensures a smooth transition into the core Data Structures Lab.
classDiagram
class Animal {
+makeSound()
}
class Dog {
+makeSound()
}
class Cat {
+makeSound()
}
Animal <|-- Dog
Animal <|-- Cat
classDiagram
class BankAccount {
-balance : double
+getBalance() double
+deposit(amount) void
}
- Clone the repository:
git clone https://github.com/Maryam-Skaik/java-ds-lab-refresher.git- Open the project in your favorite IDE (Eclipse, IntelliJ, VS Code).
- Run the examples to study concepts.
- Use the templates to implement your own exercises and experiments.
This repository corresponds to the recorded refresher lecture.
Java Revision for Data Structures – Fast Complete Refresher
Improvements and additions to this refresher module are welcome. Students and TAs may add:
- More examples
- Additional explanations
- Clarifications for beginners
This code is free to use for educational purposes.