Prof. (Dr. ) Harish Kumar MittalProfessor · Researcher · Educator

Project Based Learning in Java

Unit 1 Java Programming

A topic-wise ebook covering the complete Unit 1 sequence, from Java fundamentals to exception handling.

class extends try / catch new @Override int source code bytecode JVM runtime output javac execute App.java public class App { void run() { print("Hi"); } .class JVM executes console > java App Hello, World!

Semester 5 - 24CSH-301 / 24ITH-301

Unit 1: Java Fundamentals, OOP, and Exception Handling

Object-Oriented Programming (OOP) organises software around objects that combine state with behaviour.

Course Outcome (CO) states what a learner should be able to do after the course; CO1 to CO5 label the five syllabus outcomes.

A topic-wise ebook for Unit 1. It progresses from Java fundamentals (CO1), through object-oriented programming (CO2), to exception handling (CO3), with worked examples, diagrams, practice problems, and quick-check questions in every topic.

Course Mentor Prof. (Dr.) Harish K Mittal

Syllabus Coverage

  • Introduction to Java
  • Difference between C++ and Java
  • Keywords, tokens, and data types
  • Arrays, packages, imports, and command-line arguments
  • Use of public, private, and protected
  • Supporting fundamentals: variables, constants, operators, casting, and Scanner
  • Classes, inner classes, inheritance, abstraction, polymorphism, and encapsulation
  • Method overloading and overriding
  • Exception hierarchy, handling, checked and unchecked types, and custom exceptions

Java Virtual Machine (JVM) runs Java bytecode, the instructions produced by a Java compiler, and manages runtime tasks such as memory allocation. Java Development Kit (JDK) provides the compiler, runtime and other tools needed to build and run Java programs. Java Runtime Environment (JRE) provides the virtual machine and libraries needed to run Java programs; modern development kits include these runtime components. Write Once, Run Anywhere (WORA) describes Java's goal of running compatible bytecode on different systems that provide a suitable runtime.

01 Lecture 1.1.1 Introduction to Java Java overview, JVM flow, JDK/JRE/JVM, WORA, and first program. 02 Lecture 1.1.1 C++ vs Java Compilation, portability, pointers, memory management, and inheritance. 03 Lecture 1.1.2 Tokens, Keywords, Identifiers, and Literals Token categories, reserved words, identifiers, literals, separators, and comments. 04 Lecture 1.1.2 Java Data Types Primitive types, reference types, default values, and type selection. 05 Lecture 1.1.2 Variables and Constants Declarations, initialisation, variable kinds, and final constants. 06 Foundation Topic Operators, Expressions, Casting, and Scanner Input Operator families, precedence, widening, narrowing, casting, and Scanner. 07 Foundation Topic Control Flow and Problem Solving Decisions, loops, nested iteration, and small numerical algorithms. 08 Foundation Topic Strings and Text Processing String operations, character analysis, comparison, and StringBuilder. 09 Lecture 1.1.3 Java Access Modifiers Packages, imports, public, private, protected, default access, and encapsulation. 10 Lecture 1.1.3 Java Arrays Array declaration, indexing, traversal, multidimensional arrays, and jagged arrays. 11 Applied Topic Applied Array Algorithms Linear search, conditional aggregation, matrix processing, and argument validation. 12 Lecture 1.2.1 Classes and Inner Classes Class members, objects, static utility methods, Math, inner classes, and nested classes. 13 Lecture 1.2.1 Inheritance and Abstraction Inheritance forms, super, abstract classes, and inheritance versus composition. 14 Lecture 1.2.2 Polymorphism and Encapsulation Runtime dispatch, upcasting, encapsulation, data privacy, and controlled access. 15 Lecture 1.2.3 Method Overloading and Overriding Compile-time overloading, runtime overriding, type promotion, and super. 16 Lecture 1.3.1 Exceptions and Their Hierarchy Exception objects, Throwable hierarchy, errors, exceptions, and stack traces. 17 Lecture 1.3.2 Java Exception Handling try, catch, nested handling, finally, resources, throw, throws, and propagation. 18 Lectures 1.3.3-1.3.4 Exception Types and Custom Exceptions Checked and unchecked exceptions, common types, and custom exception design.