Object Oriented Programming using Java
SEC102 25BCA402SEC01 Object 3L:0T:4P 5
Oriented Credits
Programming
using Java
Course Objectives
CO1: To introduce the object oriented programming system concepts
CO2: To introduce syntax and semantics of Java programming language CO3:
To develop modular programs using Java
CO4: To setup JDK environment to create, debug and run Java programs
Prerequisite: Knowledge of Problem Solving Techniques using C programming language
Course Content:
UNIT I:
Fundamentals of Object Oriented Programming: Basic Concepts of Object Oriented
Programming (OOP), Benefits and Applications of OOP.
Java Evolution: Java Features, Difference between Java, C and C++, Java and Internet, Java
Environment.
Overview of Java Language: Introduction to Simple Java Program, Use of Comments and
Math function, Application of two classes, Java Program Structure, Java Tokens and
statements, Implementing Java program And JVM, Command Line Arguments. Text Book 1:
Chapters 1, 2 and 3.
UNIT II:
Constants, Variables and Data Types: Constants, Variables, Data Types, Declaration of
Variables, Giving values to Variables, Symbolic Constants, Type casting.
Operators & Expressions: Arithmetic operators, Relational operators, Logical operators,
Assignment operators, Increment & Decrement operators, conditional operators, Bitwise
operators, Arithmetic Expressions, Evaluation of Expressions, Type Conversions in
Expressions, Operator Precedence & Associativity.
Decision Making, Branching & Looping: Decision Making with Control Statements,
Looping statements, Jump in loops, Labelled loops. Text Book 1: Chapters 4, 5, 6, and 7.
UNIT III:
Classes, Objects and Methods: Defining Class, Methods Declaration, Constructors, Methods
Overloading, Overriding Methods, Inheritance
Arrays, Strings and Vectors: 1D arrays, Creating an Array, 2D arrays, Strings, Vectors,
Wrapper Classes, Enumerated Types
Inheritance: Defining, extending classes, and Implementing Interfaces. Multiple inheritance
and polymorphism.
51
Text Book 1: Chapters 8, 9, and 10.
UNIT IV:
Packages: Basics of packages, System packages, Creating and accessing packages, Creating
user defined packages, Adding class to a package.
Exception Handling: Using the main keywords of exception handling: try, catch, throw,
throws and finally; Nested try, Multiple catch statements, Creating user defined exceptions
Text Book 1: Chapters 11 & 13.
Text Books
1. Balaguruswamy E. (2023). Programming with JAVA: A Primer. 7th edition. India:
McGraw Hill Education
2. Schildt, H. (2022). Java: The Complete Reference. 12th edition. McGraw-Hill Education.
Reference Books
1. Arunesh Goyal, The Essentials of JAVA, Khanna Book Publishing Company Private
Limited, 2012.
2. Tanweer Alam, Core JAVA, Khanna Book Publishing Company Private Limited, 2015.
3. Y. Daniel Liang, Introduction to Java Programming, 7th Edition, Pearson, 2008.
4. S. Malhotra and S. Choudhary, Programming in Java, 2nd Edition, Oxford University
Press, 2014.
Web Resources
1. [Link]
2. [Link]
3. [Link]
List of Practical:
1. Write a program to read two numbers from user and print their product.
2. Write a program to print the square of a number passed through command line arguments.
3. Write a program to send the name and surname of a student through command line arguments
and print a welcome message for the student.
4. Write a java program to find the largest number out of n natural numbers.
5. Write a java program to find the Fibonacci series & Factorial of a number using recursive and
non recursive functions.
6. Write a java program to multiply two given matrices.
7. Write a Java program for sorting a given list of names in ascending order.
8. Write a Java program that checks whether a given string is a palindrome or not . Ex:MADAM
is a palindrome.
9. Write a java program to read n number of values in an array and display it in reverse order.
10. Write a Java program to perform mathematical operations. Create a class called AddSub with
methods to add and subtract. Create another class called MulDiv that extends from AddSub class
to use the member data of the super class. MulDiv should have methods to multiply and divide
A main function should access the methods and perform the mathematical operations.
11. Create a JAVA class called Student with the following details as variables within it.
52
a. USN, NAME, BRANCH, PHONE, PERCENTAGE
b. Write a JAVA program to create n Student objects and print the USN, Name, Branch, Phone,
and percentage of these objects with suitable headings.
12. Write a Java program that displays the number of characters, lines and words in a text.
13. Write a Java program to create a class called Shape with methods called getPerimeter() and
getArea(). Create a subclass called Circle that overrides the getPerimeter() and getArea()
methods to calculate the area and perimeter of a circle.
14. Write a Java program to create a class Employee with a method called calculateSalary(). Create
two subclasses Manager and Programmer. In each subclass, override the calculateSalary()
method to calculate and return the salary based on their specific roles.
15. Write a Java program using an interface called ‘Bank’ having function ‘rate_of_interest()’.
Implement this interface to create two separate bank classes ‘SBI’ and ‘PNB’ to print different
rates of interest. Include additionalm ember variables, constructors also in classes ‘SBI’ and
‘PNB’.
16. Write a Java package program for the class book and then import the data from the package and
display the result.
17. Write a Java program for finding the cube of a number using a package for various data types
and then import it in another class and display the results.
18. Write a Java program for demonstrating the divide by zero exception handling.
19. Write a Java program that reads a list of integers from the user and throws an exception if any
numbers are duplicates.
20. Create an exception subclass UnderAge, which prints “Under Age” along with the age value
when an object of UnderAge class is printed in the catch statement. Write a class exceptionDemo
in which the method test() throws UnderAge exception if the variable age passed to it as
argument is less than 18. Write main() method also to show working of the program.
******
53