Logo

BITM Object Oriented Programming in Java

bitmsemester 2

Object Oriented Programming in Java

Subject Code: ITM152

Course Title: Object Oriented Programming in Java

Course No: ITM152

Nature of Course: Theory & Practical

Full Marks: 60

Pass Marks: 30

Credit Hours: 3

Course Description

This course provides a comprehensive introduction to Object Oriented Programming (OOP) using Java as the primary implementation language. Building upon the foundations of Structured Programming in C, students will transition to the object-oriented paradigm and develop proficiency in Java's type system, class hierarchy, inheritance, interfaces, exception handling, file handling, generics, and essential Java library classes. The course bridges fundamental programming knowledge with modern software design principles, equipping students to design modular, reusable, and robust applications. Equal emphasis is placed on theoretical understanding and hands on laboratory work, preparing students for advanced software development courses and industry roles.

Course Objective

By the end of this course, students will be able to Understand the history, features, and architecture of Java (JVM, JRE, JDK) and the object-oriented paradigm. Demonstrate knowledge of Java fundamentals including data types, variables, operators, and control statements. Define and use classes, objects, constructors, methods, and access control to implement encapsulation. Apply inheritance, method overriding, abstract classes, and interfaces to build extensible class hierarchies. Utilize arrays, strings, and essential Java library classes for solving computational problems. Handle exceptions effectively using Java's built-in and user-defined exception mechanisms. Implement file handling operations (text, binary, serialization) for data persistence. Apply generic programming concepts and use the Java Collections Framework. Write multi-threaded programs and manage concurrency issues. Develop complete Java applications using good software engineering practices

Course Contents

Course Contents Teaching Methodology Teaching Hours
Unit 1: Introduction to Java (5 Hrs.)
The Creation of Java Lecture/Lab
Java's lineage and its influence on modern programming
Java's impact on the Internet
Java Buzzwords (Simple, Object-Oriented, Robust, Multithreaded, Architecture Neutral, Interpreted, High Performance, Distributed, Dynamic)
Java Virtual Machine (JVM), Java Runtime Environment (JRE), and Java Development Kit (JDK) architecture and roles
The Bytecode
compilation model vs. interpretation model
Platform independence
Writing, Compiling, and Running Simple Java Programs using Command Line and IDE
Object-Oriented Programming Paradigm: Overview of OOP principles (Encapsulation, Inheritance, Polymorphism, Abstraction)
Using Command Line Arguments
Reading Input with Scanner
Writing Output with System.out
Unit 2: Fundamental Programming Structures (6 Hrs.)
Writing Comments Lecture/Lab
Primitive Data Types (byte, short, int, long, float, double, char, boolean)
Variables and Constants
Type Conversion and Casting
Automatic Type Promotion Rules
Operators: Arithmetic, Bitwise, Relational, Logical (short-circuit), Assignment, Conditional (?:), sizeof equivalent
Operator Precedence and Associativity
Using Parentheses
Control Statements: if, if else, nested if else, else if ladder, switch
Iteration Statements: while, do while, for, enhanced for each loop, nested loops
Jump Statements: break, continue, return
Working with Big Numbers (BigInteger, BigDecimal overview)
Declaration, Initialization, and Processing of One Dimensional and Multidimensional Arrya
Passing Arrays to Methods
Unit 3: Classes and Objects (8 Hrs.)
Object Oriented Principles: Encapsulation, Abstraction, Inheritance, Polymorphism Lecture/Lab
Defining Classes: fields, methods, and the general form of a class
Creating Objects and Accessing Class Members
Assigning Object Reference Variables
Methods: Adding Methods, Returning Values, Method Parameters and Return Types
Method Overloading
Constructors: Default and Parameterized
Constructor Overloading
the this Keyword
Variable Length Arguments
Access Control: public, private, protected, default
JavaBeans convention
static Fields and Methods
final Variables, Methods, and Classes
The Object Class
Nested and Inner Classes: static nested, inner, local, and anonymous classes
Garbage Collection and Finalization
Object Lifecycle
Creating and Using Packages
import statements
CLASSPATH
Unit 4: Inheritance and Interfaces (7 Hrs.)
Inheritance Basics: extends keyword, member access, IS-A relationship Lecture/Lab
Using super: calling superclass constructors and overridden methods
Method Overriding: rules, @Override annotation, covariant return types
Dynamic Method Dispatch: runtime polymorphism
why overridden methods matter
Abstract Classes: abstract methods and the template method concept
inheritance types
Using final with Inheritance (preventing overriding and subclassing)
Interfaces: defining, implementing, and extending interfaces
Default and Static Methods in Interfaces (Java 8+)
multiple interface inheritance
Functional Interfaces and the @FunctionalInterface annotation
Sealed Classes overview
Liskov Substitution Principle
Unit 5: Exception Handling (4 Hrs.)
Exception Handling Fundamentals Lecture/Lab
Exception Hierarchy: Throwable, Error, Exception, Runtime Exception
Checked vs. Unchecked Exceptions
understanding uncaught exceptions and stack traces
Using try, catch, and finally blocks
multiple catch clauses
nested try statements
Multi catch (Java 7+)
try with resources for automatic resource management
throw and throws keywords
exception chaining (initCause, getCause)
Java's Built in Exceptions overview
Creating Custom Exception Subclasses
best practices for exception design
Unit 6: Generics and Collections (5 Hrs.)
Importance of Generic Programming Lecture/Lab
defining Generic Classes and Methods
type parameters
Bounded Wildcards (extends/super)
type erasure and heap pollution
Restrictions and Limitations of Generics
Inheritance Rules with Generics
The Java Collections Framework: List, Set, Map, Queue, and Deque interfaces
Iterators and the Iterable interface
enhanced for loop with collections
Type Wrappers: Character, Boolean, numeric wrappers
Autoboxing and Unboxing
Autoboxing in expressions
autoboxing with Boolean and Character
preventing errors
Unit 7: Multithreaded Programming (5 Hrs.)
The Java Thread Model: threads vs. processes Lecture/Lab
benefits of multithreading
Thread Priorities
synchronization
messaging between threads
The Thread Class and the Runnable Interface
the main thread
Creating Threads: implementing Runnable
extending Thread class
Creating Multiple Threads
using isAlive() and join()
Thread Priorities and scheduling
Synchronization: synchronized methods and synchronized statements
Unit 8: Essential Java Classes (3 Hrs.)
String Class: constructors, length, special operators (concatenation, conversion, toString()) Lecture/Lab
Character extraction: charAt() and getChars()
String comparison methods
Modifying Strings: substring(), concat(), replace(), trim()
StringBuffer and StringBuilder: mutable strings, performance considerations
String Handling Library Functions overview
Math Class: commonly used mathematical methods
Primitive Type Wrappers: Character, Boolean, Integer, Double methods and conversions
Introduction to Lambda Expressions and Stream API (overview for modern Java awareness)
Unit 9: File Handling (5 Hrs.)
Introduction to Files Lecture/Lab
File class: creating, deleting, listing files and directories
File Modes and I/O Exceptions
AutoCloseable, Closeable, and Flushable Interfaces
Byte Streams: InputStream, OutputStream, FileInputStream, FileOutputStream
PrintStream, DataOutputStream, DataInputStream
RandomAccessFile for random access
Character Streams: Reader, Writer
FileReader, FileWriter, PrintWriter, BufferedReader, BufferedWriter
The Console Class
reading from standard input and writing formatted output
NIO.2 API (java.nio.file): Path, Files, Paths modern file operations
Sequential and Random Access to Files
Serialization: Serializable interface, ObjectOutputStream, ObjectInputStream
I/O Classes and Interfaces review

Text Books

1. Horstmann, C. S. (2022). Core Java: Volume I — fundamentals (12th ed.). Pearson Education.
2. Schildt, H. (2022). Java: The complete reference (12th ed.). McGraw Hill.
3. Bloch, J. (2018). Effective Java (3rd ed.). Addison-Wesley.
4. Deitel, P., & Deitel, H. (2020). Java: How to program (11th ed.). Pearson.
5. Loy, M., Niemeyer, P., & Leuck, D. (2020). Learning Java: An introduction to real-world programming with Java. O'Reilly Media.
6. Eckel, B. (2006). Thinking in Java (4th ed.). Prentice Hall.
7. Oracle Corporation. (2023). Java SE 21 documentation. https://docs.oracle.com/en/java/javase/21/

Lab Works

Students are required to complete hands-on programming exercises for every unit. The following practical tasks are prescribed:
Unit 1 Lab: Write and execute basic Java programs; explore JDK tools (javac, java); use Scanner for input
Unit 2 Lab: Programs using operators, type casting, control statements, and arrays
Unit 3 Lab: Design and implement classes with constructors, method overloading, static members, and packages
Unit 4 Lab: Build class hierarchies using inheritance; demonstrate polymorphism and interface implementation
Unit 5 Lab: Programs with try-catch-finally, custom exceptions, and try-with-resources
Unit 6 Lab: Implement generic classes/methods; use ArrayList; and sorting with Comparator
Unit 7 Lab: Create multithreaded programs; demonstrate synchronization and deadlock prevention; use Enumerations
Unit 8 Lab: String processing programs; use StringBuilder, Math class, and wrapper classes
Unit 9 Lab: File I/O programs — text file read/write, binary file handling, random access, and object serialization; develop a record-keeping system with search and manipulation features