You are on page 1of 2

CHANDIGARH UNIVERSITY, GHARUAN

Programming in Java L T P C
Subject Code
Total Contact Hours: 32 Hours 0 0 3 1.5
CSP-218
Prerequisite: Programming in C++

Marks-100

Internal-60 External-40

Course Objectives

 Learn about the flaws in C/C++ and how java overcomes them
 Understand the concept of OOPs and implement them with Java
 Understand how frameworks and collections can be used in Java
 Understand the multithreading and database connectivity concept.
Unit Course Outcomes

I Designing of Java Basic programs using if-else, loops and operators

II To have the knowledge of OOPs concept and their Implementations.

III Implementation of multithreading and database connectivity with Java

List of Experiments

Sr. No. Name of the Experiments

UNIT-I

Java Basics
1. Write a program to check the entered number is even or odd.
2. Write a program to check the entered number is even or odd without using
I. modules operator.
3. Write a java Program to swap two numbers without using 3rd variable.
4. Write a java program to find factorial of a given number.

1. Write a program to initialize an integer array and print the sum and
average of the array.
II.
2. Write a program to find all prime numbers within a given range.
3. Write a program to check the entered number is perfect no or not.
Write a Java program to illustrate the use of Class, Object and Constructor.
III.

Create a class named ‘Animal’ which includes methods like eat() and sleep().
Create a child class of Animal named ‘Bird’ and override the parent class
methods. Add a new method named fly().
Create an instance of Animal class and invoke the eat and sleep methods using
IV.
this object.
Create an instance of Bird class and invoke the eat, sleep and fly methods using
this object.

UNIT -II

V. Write a Program to check whether a given String is Palindrome or not.


Get an input String from user and parse it to integer, if it is not a number it will
VI. throw number format exception Catch it and print "Entered input is not a valid
format for an integer." or else print the square of that number.
VII Write a java Program to demonstrate the operations of File Handling.

UNIT-III
Java Program to create threads using Thread Class and Runnable Interface.
VIII Create two threads and assign names ‘Thread1’ and ‘Thread2’ to the two threads.
Display both thread names.
Create an ArrayList that can store only Strings.
IX Create a printAll method that will print all the elements of the ArrayList using
an Iterator.

X Write a Java Program to insert the Student details into database using JDBC.

You might also like