SEMESTER: III HOURS/WEEK : 6
COURSE CODE: U24CS303 CREDITS :6
Java Programming
Unit I: Introduction
Review of Object Oriented concepts – History of Java – Java buzzwords – JVM architecture - Data
Types - Variables - Scope and lifetime of variables - arrays - operators – control statements - type
conversion and casting - simple java program - constructors - methods - Static block - Static Data –
Static Method String and StringBuffer Classes.
Unit II: Inheritance, Packages, Interfaces & Exception Handling
Inheritance: Basic concepts - Types of inheritance - Member access rules - Usage of this and Super
key word - Method Overloading - Method overriding - Abstract classes - Dynamic method dispatch -
Usage of final keyword. Packages: Definition - Access Protection - Importing Packages. Interfaces:
Definition – Implementation – Extending Interfaces. Exception Handling: try – catch - throw - throws
– finally – Built-in exceptions - Creating own Exception classes.
Unit III: Multithreaded Programming & I/O Streams
Thread: Thread Class - Runnable interface – Synchronization – Using synchronized methods – Using
synchronized statement - Inter thread Communication – Deadlock. I/O Streams: Concepts of streams
- Stream classes - Byte and Character stream - Reading console Input and Writing Console output - File
Handling.
Unit IV: AWT Controls & Event Handling
AWT Controls: The AWT class hierarchy - user interface components- Labels - Button - Text
Components - Check Box - Check Box Group - Choice - List Box - Panels – Scroll Pane - Menu - Scroll
Bar. Working with Frame class - Colour - Fonts and layout managers. Event Handling: Events - Event
sources - Event Listeners - Event Delegation Model (EDM) - Handling Mouse and Keyboard Events -
Adapter classes - Inner classes
Unit V: Swing
Introduction to Swing - Hierarchy of swing components. Containers - Top level containers – J Frame –
J Window – JDialog – JPanel – JButton – J toggle Button – J Check Box – J Radio Button – J Label, J
Text Field – J Text Area – J List – J ComboBox – J Scroll Pane.
Text Book(s):
1. Herbert Schildt, “Java: The Complete Reference”, Tata McGraw Hill, New Delhi, 12th Edition,
2022
Reference Book(s):
1. Gary Cornell, Core Java 2 Volume I – Fundamentals, Addison Wesley, 2019
2. Head First Java, O’Rielly Publications, 2016
3. Y. Daniel Liang, Introduction to Java Programming, 7th Edition, Pearson Education India,
2010.
SEMESTER: III HOURS/WEEK : 3
COURSE CODE: U24CS3P3 CREDITS :2
Java Programming Lab
1. Write a Java program that prompts the user for an integer and then prints out all the prime
numbers up to that Integer
2. Write a Java program to multiply two given matrices.
3. Write a Java program that displays the number of characters, lines and words in a text
4. Generate random numbers between two given limits using Random class and print messages
according to the range of the value generated.
5. Write a program to do String Manipulation using Character Array and perform the following
string operations:
a. String length
b. Finding a character at a particular position
c. Concatenating two strings
6. Write a program to perform the following string operations using String class:
a. String Concatenation
b. Search a substring
c. To extract substring from given string
7. Write a program to perform string operations using String Buffer class:
a. Length of a string
b. Reverse a string
c. Delete a substring from the given string
8. Write a java program that implements a multi-thread application that has three threads. First
thread generates random integer every 1 second and if the value is even, second thread
computes the square of the number and prints. If the value is odd, the third thread will print the
value of cube of the number.
9. Write a threading program which uses the same method asynchronously to print the numbers
1to10 using Thread1 and to print 90 to100 using Thread2.
10. Write a program to demonstrate the use of following exceptions.
a. Arithmetic Exception
b. Number Format Exception
c. Array Index Out of Bound Exception
d. Negative Array Size Exception
11. Write a Java program that reads on file name from the user, then displays information about
whether the file exists, whether the file is readable, whether the file is writable, the type of file
and the length of the file in bytes
12. Write a program to accept a text and change its size and font. Include bold italic options. Use
frames and controls.
13. Write a Java program that handles all mouse events and shows the event name at the center of
the window when a mouse event is fired. (Use adapter classes).
14. Write a Java program that works as a simple calculator. Use a grid layout to arrange buttons for
the digits and for the +, -,*, % operations. Add a text field to display the result. Handle any
possible exceptions like divide by zero.
15. Write a Java program that simulates a traffic light. The program lets the user select one of three
lights: red, yellow, or green with radio buttons. On selecting a button, an appropriate message
with “stop” or “ready” or “go” should appear above the buttons in a selected color. Initially
there is no message shown.