2025-26 MCA OBJECT ORIENTED PROGRAMMING WITH JAVA (MCA1105)

OOPS with JAVA (MCA1105)

R20 MCA Syllabus – Complete Details & Unit-wise Material

Course Objectives

  • 1. Understand the basic concepts of object-oriented programming.
  • 2. Introduce inheritance, polymorphism, and abstract class design.
  • 3. Learn packages, interfaces, and their implementation.
  • 4. Understand multithreading and exception handling.
  • 5. Design GUI using AWT, Applets, and Swing controls.

Course Outcomes

  • 1. Describe and apply OOP concepts to solve problems.
  • 2. Implement packages and interfaces in Java.
  • 3. Develop multithreaded applications with exception handling.
  • 4. Design GUI-based applications using AWT and Swing.
  • 5. Use Java Collection Framework effectively.

Unit 1: Basics of OOP & Java Fundamentals

Need for OO paradigm , A way of viewing world- Agents, responsibility, messages, methods, classes and instances, class hierarchies (Inheritance), method binding, overriding and exceptions, summary of OOP concepts, coping with complexity, abstraction mechanisms. Java Basics: Data types, variables, scope and life time of variables, arrays, operators, expressions, control statements, type conversion and costing, simple java program, classes and objects- concepts of classes, objects, constructors methods, access control, this keyword, garbage collection, overloading methods and constructors, parameter passing, recursion, string handling.

📥 Download Unit 1 Material

Unit 2: Inheritance, Packages & Interfaces

Inheritance: Hierarchical abstractions, Base class object, subclass, subtype, substitutability, forms of inheritance- specialization, specification, construction, extension, limitation, combination, benefits of inheritance costs of inheritance. Member access rules, super uses, using final with inheritance, polymorphism, abstract classes. Packages and Interfaces: Defining, Creating and Accessing a package, Understanding CLASSPATH, Importing packages, differences between classes and interfaces, defining an interface, Implementing interface, applying interfaces variables in interface and extending interfaces.

📥 Download Unit 2 Material

Unit 3: Exception Handling & Multithreading

Concepts of exception handling, benefits of exception handling, Termination or presumptive models, exception hierarchy, usage of try, catch, throws and finally, built in exceptions, creating own exception sub classes. Differences between multi threading and multitasking, thread life cycle, creating threads, synchronizing threads, daemon threads, thread groups.

📥 Download Unit 3 Material

Unit 4: Event Handling & AWT Components

Events, Event sources, Event classes, Event Listeners, Delegation event model, handling mouse and keyboard events, Adapter classes, inner classes. The AWT class hierarchy , user-interface components- labels, button, canvas, scrollbars, text components, check box, check box groups, choices, list panes- scroll pane, dialogs, menu bar, graphics, layout manager- layout manager types- boarder, grid, flow, card and grid bag.

📥 Download Unit 4 Material

Unit 5: Applets & Swing

Concepts of Applets, differences between applets and applications, lifecycle of an applet, types of applets, creating applets, passing parameters to applets, Swings: Introduction, limitations of AWT, MVC architecture, components, containers, exploring swing- JApplet, JFrame and JComponent, Icons and Labels, text fields, buttons-The JButton class, Check boxes, Radio Buttons, Combo boxes, Tabbed panes, Scroll panes, Trees and Tables.

📥 Download Unit 5 Material

Text Books

  • Java – The Complete Reference, Herbert Schildt, TMH.
  • JAVA: How to Program, Dietel & Dietel, PHI.
  • Introduction to Programming with JAVA, S. Dean, TMH.
  • Introduction to Java Programming, Y. Daniel Liang, Pearson.

Reference Books

  • Core Java 2, Vol 1 & Vol 2, Cay S. Horstmann & Gary Cornell, Pearson.
  • Big Java 2, Cay S. Horstmann, Wiley.
  • Object Oriented Programming through Java, P. Radha Krishna, University Press.
  • JAVA & Object Orientation: An Introduction, John Hunt, Springer.

netaji gandi Wednesday, August 13, 2025
GATE Previous Year Question Papers (2007 to 2023) All Branches

GATE

Previous Year Question Papers (2007 to 2023)

Question Papers of Previous Years

Click on your branch below to download the bulk question papers from 2007 to 2023.

netaji gandi
Daemon Threads

 

Daemon Threads

In this article we will learn what are daemon threads? and how to make thread as daemon thread along with example Java program.

 

A daemon thread is a thread which runs in the background. Example for daemon thread in Java is the garbage collector. In Java, thread can be divided into two categories:

  1. User threads
  2. Daemon threads

 


A user thread is a general thread which is created by the user. A daemon thread is also a user thread which is made as a daemon thread (background thread).

 

Difference between a user thread and a daemon thread is, a Java program will not terminate if there is at least one user thread in execution. But, a Java program can terminate if there are one or more daemon threads in execution.

 

To work with daemon threads, Java provides two methods:

 

void setDaemon(boolean flag)

boolean isDaemon()

 

The setDaemon() method is used to convert a user thread into a daemon thread. The isDaemon() thread can be used to know whether a thread is a daemon thread or not.


Below program demonstrates a daemon thread:

class ChildThread implements Runnable
{
	Thread t;
	ChildThread(String name)
	{
		t = new Thread(this, name);
		t.setDaemon(true);
		t.start();
	}
	public void run()
	{
		try
		{
			while(true)
			{
				System.out.println("This thread is a daemon thread: "+t.isDaemon());
				System.out.println(t.getName()+": Hi");
				Thread.sleep(1000);
			}
		}
		catch(InterruptedException e)
		{
			System.out.println("Child thread is interrupted");
		}
	}
}
class DaemonThread
{
	public static void main(String args[])
	{
		ChildThread one = new ChildThread("Daemon Thread");
	}
}
Java

 

Output of the above program is:

This thread is a daemon thread: true

Daemon Thread: Hi

Daemon Thread: Hi

Daemon Thread: Hi

Daemon Thread: Hi

netaji gandi Tuesday, August 12, 2025
Swayam NPTEL Programming in Java Programming Assignment July-2025 Week-1 and Week-2

Week 01 : Programming Assignment 1

Due on 2025-08-07, 23:59 IST

Write a Java program to check if a given integer is “Positive” or “Negative”.

(0 (Zero) should be considered positive by this program.)

 

NOTE:

The code you see is not complete.

Your task is to complete the code as per the question.
Think of it like a programming puzzle.

 

(Remember to match the output given exactly, including the spaces and new lines)

(Passed with presentation error means you will get full marks)

Your last recorded submission was on 2025-07-24, 10:13 IST
Select the Language for this assignment. 
File name for this program : 
import java.util.Scanner;
 
public class W01_P1 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int number = in.nextInt();
// Check if the number is Positive or Negative and print accordingly
if (number >= 0) {
  System.out.print("Positive");
} else {
  System.out.print("Negative");
}
in.close();
    }
}
   


 
 
Public Test CasesInputExpected OutputActual OutputStatus
Test Case 1
4
Positive
Positive
Passed
Test Case 2
-3
Negative
Negative
Passed



Week 01 : Programming Assignment 2

Due on 2025-08-07, 23:59 IST

Write a Java program to calculate the volume of a cylinder given its radius and height.

Formula:

You can use Math.PI for the computation.

NOTE:

The code you see is not complete.

Your task is to complete the code as per the question.
Think of it like a programming puzzle.

(This question can be solved in just one line of code)


Your last recorded submission was on 2025-07-24, 10:15 IST
Select the Language for this assignment. 
File name for this program : 
import java.util.Scanner;
 
public class W01_P2 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        double radius = in.nextDouble();
        double height = in.nextDouble();
// Calculate the volume
double volume = Math.PI * radius * radius * height;
// Display the result
    System.out.printf("Volume is: %.2f", volume);
    in.close();
  }
}
   


 
 
Public Test CasesInputExpected OutputActual OutputStatus
Test Case 1
3.5
5.0
Volume is: 192.42
Volume is: 192.42
Passed



Week 01 : Programming Assignment 3

Due on 2025-08-07, 23:59 IST

Write a Java program to print the multiplication table of a given number up to 4.

 

NOTE:

Print EXACTLY as shown in the sample output.

DO NOT MISS a single space otherwise you will not be scored.

(Remember to match the output given exactly, including the spaces and new lines)

(passed with presentation error means you will get full marks)

Your last recorded submission was on 2025-07-24, 10:16 IST
Select the Language for this assignment. 
File name for this program : 
import java.util.Scanner;
 
public class W01_P3 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int number = in.nextInt();
// Print the multiplication table of number up to 5
for (int i = 1; i <= 4; i++)
  System.out.printf("%d x %d = %d\n", number, i, number * i);
in.close();
    }
}
   


 
 
Public Test CasesInputExpected OutputActual OutputStatus
Test Case 1
5
5 x 1 = 5\n
5 x 2 = 10\n
5 x 3 = 15\n
5 x 4 = 20
5 x 1 = 5\n
5 x 2 = 10\n
5 x 3 = 15\n
5 x 4 = 20\n
Passed after ignoring Presentation Error



Week 01 : Programming Assignment 4

Due on 2025-08-07, 23:59 IST

Complete the code fragment that reads two integer inputs from keyboard and compute the quotient and remainder.

Your last recorded submission was on 2025-07-24, 10:18 IST
Select the Language for this assignment. 
File name for this program : 
import java.util.Scanner;
public class W01_P4{
       public static void main(String[] args) {
       Scanner sc = new Scanner(System.in);
       int x=sc.nextInt();
       int y=sc.nextInt();
//code for quotient and remainder
if (y == 0) {
  System.out.println("Error: Division by zero is not allowed.");
}
else {
  int quotient = x / y;
  int remainder = x % y;
  System.out.println("The Quotient is = " + quotient);
  System.out.print("The Remainder is = " + remainder);
}
sc.close();  
  }
}
   


 
 
Public Test CasesInputExpected OutputActual OutputStatus
Test Case 1
556
9
The Quotient is = 61\n
The Remainder is = 7
The Quotient is = 61\n
The Remainder is = 7
Passed



Week 01 : Programming Assignment 5

Due on 2025-08-07, 23:59 IST

Write a Java program to print the area and perimeter of a rectangle.

Your last recorded submission was on 2025-07-24, 10:19 IST
Select the Language for this assignment. 
File name for this program : 
import java.util.Scanner;
public class W01_P5 { 
   public static void main(String[] strings) {
       double width ;
       double height;
       Scanner in = new Scanner(System.in);
       width = in.nextDouble();
       height = in.nextDouble();
// Calculate the perimeter of the rectangle
double perimeter = 2 * ( height + width ) ;
// Calculate the area of the rectangle
double area = height * width;
// Print the calculated perimeter using placeholders for values
       System.out.printf("Perimeter is 2*(%.1f + %.1f) = %.2f\n", height, width, perimeter);
 
// Print the calculated area using placeholders for values
       System.out.printf("Area is %.1f * %.1f = %.2f", width, height, area);    
   }
}
   


 
 
Public Test CasesInputExpected OutputActual OutputStatus
Test Case 1
5.6 8.5
Perimeter is 2*(8.5 + 5.6) = 28.20\n
Area is 5.6 * 8.5 = 47.60
Perimeter is 2*(8.5 + 5.6) = 28.20\n
Area is 5.6 * 8.5 = 47.60
Passed




W02 Programming Assignments 1

Due on 2025-08-07, 23:59 IST

Write a Java program to calculate the area of a rectangle.

The formula for area is:
Area = length × width

You are required to read the length and width from the user, compute the area, and print the result.

This task helps you practice using variables, arithmetic operations, and printing output in Java.

Your last recorded submission was on 2025-08-01, 16:57 IST
Select the Language for this assignment. 
File name for this program : 
import java.util.Scanner;
 
public class W02_P1 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
 
        // Read length and width of the rectangle
        int length = sc.nextInt();
        int width = sc.nextInt();
// ================================================
        // NOTE TO STUDENTS:
        // This is a simple beginner-level task.
        // Your role is to calculate the area using the given length and width.
        // Complete the line below using the correct formula.
        // ================================================
 
        // TODO: Calculate area of the rectangle
 
        /*
         Hint:
         - Multiply length and width to get the area
         - Store the result in a variable called 'area'
         */
int area = length * width;
// Print the area
        System.out.print("Area is: " + area);
 
        sc.close();
    }
}
   


 
 
Public Test CasesInputExpected OutputActual OutputStatus
Test Case 1
5
10
Area is: 50
Area is: 50
Passed



W02 Programming Assignments 2

Due on 2025-08-07, 23:59 IST

Problem Statement

Write a Java program to calculate the perimeter of a rectangle.

The formula for perimeter is:
Perimeter = 2 multiplied by (length + width)

You are required to read the length and width as integers from the user, compute the perimeter, and print the result.

This problem helps in practicing arithmetic operations and output printing in Java.

Your last recorded submission was on 2025-08-01, 16:59 IST
Select the Language for this assignment. 
File name for this program : 
import java.util.Scanner;
 
public class W02_P2 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
 
        // Read length and width of the rectangle
        int length = sc.nextInt();
        int width = sc.nextInt();
// Complete the code to calculate the perimeter of the rectangle
        // TODO: Calculate the perimeter using the correct formula
        /*
         Hint:
         The formula is: perimeter = 2 multiplied by (length + width)
         */
int perimeter = 2 * (length + width);
System.out.println("Perimeter is: " + perimeter);
 
        sc.close();
    }
}
   


 
 
Public Test CasesInputExpected OutputActual OutputStatus
Test Case 1
4  
6
Perimeter is: 20
Perimeter is: 20\n
Passed after ignoring Presentation Error



W02 Programming Assignments 3

Due on 2025-08-07, 23:59 IST

Finding the Maximum Element in an Array


Problem Statement

What is the Maximum Element?
In an array of numbers, the maximum is the largest number among all elements.

In this assignment:

  • You will read n numbers from the user

  • Store them in an array

  • Find the largest number among them

  • Print the maximum number

This task helps you apply loops and arrays together to solve a real logic-based problem.

Your last recorded submission was on 2025-08-01, 17:00 IST
Select the Language for this assignment. 
File name for this program : 
import java.util.Scanner;
 
public class W02_P3 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
 
        int n = sc.nextInt();
        int[] arr = new int[n];
 
        // Read n numbers into array
        for (int i = 0; i < n; i++) {
            arr[i] = sc.nextInt();
        }
 
        int max = arr[0];  // Assume first element is maximum
// TODO: Use a loop to find maximum element
        /*
         Hint:
         Start loop from index 1 to n - 1
         Compare each element with max
         If element is greater, update max
         */
for (int i = 1; i < n; i++) {
  if (arr[i] > max) {
    max = arr[i];
  }
}
System.out.println("Maximum is: " + max);
 
        sc.close();
    }
}
   


 
 
Public Test CasesInputExpected OutputActual OutputStatus
Test Case 1
5  
15 42 9 28 37
Maximum is: 42
Maximum is: 42\n
Passed after ignoring Presentation Error



W02 Programming Assignments 4

Due on 2025-08-07, 23:59 IST

Create a Class and Access Its Member Variable


Problem Statement

In this task, you will practice creating and using a class in Java.

You need to:

  1. Create a class called Rectangle

  2. Declare two integer member variables length and width

  3. In the main method, create an object of the Rectangle class, assign values to length and width, and print their sum

This problem helps you understand how to define a class, create objects, and access class members in Java.

Your last recorded submission was on 2025-08-01, 17:01 IST
Select the Language for this assignment. 
File name for this program : 
import java.util.Scanner;
 
public class W02_P4 {
 
    // Declare a class named Rectangle
    static class Rectangle {
        int length;
        int width;
    }
 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
 
        // Read length and width
        int l = sc.nextInt();
        int w = sc.nextInt();
 
        // Create an object of the Rectangle class
        Rectangle rect = new Rectangle();
 
        // Assign values to the object's member variables
        rect.length = l;
        rect.width = w;
// Complete the code to print the sum of length and width
        // TODO: Print the sum using rect.length and rect.width
        /*
         Hint:
         Use: rect.length + rect.width to get the sum
         Print the result using System.out.println
         tip--System.out.println("Sum of length and width is: " +.....)
         */
System.out.println("Sum of length and width is: " + (rect.length + rect.width));
sc.close();
    }
}
   


 
 
Public Test CasesInputExpected OutputActual OutputStatus
Test Case 1
5  
10
Sum of length and width is: 15
Sum of length and width is: 15\n
Passed after ignoring Presentation Error



W02 Programming Assignments 5

Due on 2025-08-07, 23:59 IST

Working with Multiple Classes, Constructors, and the this Keyword


Problem Statement

In this task, you will learn how to:

  • Declare multiple classes in the same Java program

  • Use constructors to initialize values

  • Apply the this keyword to refer to instance variables

What you need to do:

  1. Declare a class called Circle with one member variable radius

  2. Write a constructor for Circle that takes radius as a parameter and assigns it using the this keyword

  3. In the main method, create an object of Circle and print its radius

This task helps understand how classes work together and how constructors and the this keyword are used for clarity.


Your last recorded submission was on 2025-08-01, 17:02 IST
Select the Language for this assignment. 
File name for this program : 
import java.util.Scanner;
 
public class W02_P5 {
 
    // Declare a separate class named Circle
    static class Circle {
 
        int radius;
// TODO: Write a constructor that takes radius as parameter
        // Use the 'this' keyword to assign the value to the member variable
        /*
         Hint:
         The constructor name should be Circle
         Use: this.radius = radius;
         */
public Circle(int radius) {
  this.radius = radius;
}
}
 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
 
        // Read radius value from user
        int r = sc.nextInt();
 
        // Create an object of Circle class using constructor
        Circle c = new Circle(r);
 
        // Print the radius using object member
        System.out.println("Radius of the circle is: " + c.radius);
 
        sc.close();
    }
}
   


 
 
Public Test CasesInputExpected OutputActual OutputStatus
Test Case 1
7
Radius of the circle is: 7
Radius of the circle is: 7\n
Passed after ignoring Presentation Error

netaji gandi Monday, August 11, 2025

2025-26 MCA OBJECT ORIENTED PROGRAMMING WITH JAVA (MCA1105)

OOPS with JAVA (MCA1105) R20 MCA Syllabus – Complete Details & Unit-wise Material Course Objectiv...