You are on page 1of 4

JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD

II Year B.Tech. CSE-II Sem

T/P/D
4
-/-/-

C
4

(A40503) JAVA PROGRAMMING


Objectives:
To understand object oriented concepts, and apply them in problem solving.
To learn the basics of java Console and GUI based programming.
UNIT I :
OOP Concepts: - Data abstraction, encapsulation, inheritance, benefits of inheritance,
polymorphism, classes and objects, Procedural and object oriented programming paradigms.
Java programming - History of Java, comments, data types, variables, constants, scope and life
time of variables, operators, operator hierarchy, expressions, , type conversion and casting,
enumerated types, control flow block scope, conditional statements, loops, break and continue
statements, simple java stand alone programs, arrays, console input and output, formatting
output, constructors, methods, , parameter passing, static fields and methods, access control, this
reference, overloading methods and constructors, recursion, , garbage collection, building
strings,, exploring string class
UNIT II :
Inheritance Inheritance hierarchies, super and sub classes, Member access rules, super
keyword, preventing inheritance: final classes and methods, the Object class and its methods.
Polymorphism- dynamic binding, method overriding, abstract classes and methods.
Interfaces Interfaces vs Abstract classes, defining an interface, implementing interfaces,
accessing implementation through interface references, extending interface.
Inner classes- Uses of inner classes, local inner classes, anonymous inner classes, static inner
classes, examples.
Packages- Defining, Creating and Accessing a Package, Understanding CLASSPATH, importing
packages.
UNIT III :
Exception handling Dealing with errors, benefits of exception handling, the classification of
exceptions- exception hierarchy, checked exceptions and unchecked exceptions, usage of try,
catch, throw, throws and finally, re throwing exceptions, exception specification,built in
exceptions, creating own exception sub classes.
Multithreading - Differences between multiple processes and multiple threads, thread states,
creating threads, interrupting threads, thread priorities, synchronizing threads, inter-thread
communication, producer consumer pattern.

UNIT IV :
Collection Framework In Java- Introduction to Java Collections, Overview of Java Collection
frame work, Generics, Commonly used Collection classes- Array List, Vector, Hash table, Stack,
Enumeration, Iterator, String Tokenizer, Random, Scanner, calendar and Properties.
Files- Streams-byte streams, character streams, text input/output, binary input/output, random
access file operations, File management using File class.
Connecting to Database- JDBC Type 1 to 4 drivers, connecting to a database, querying a
database and processing the results, updating data with JDBC.
UNIT V
GUI Programming with Java - The AWT class hierarchy, Introduction to Swing, Swing vs
AWT, Hierarchy for Swing components, Containers Jframe, JApplet, JDialog, JPanel.
Overview of some Swing components Jbutton, JLabel, JTexField, JTextArea, simple swing
applications, Layout management - Layout manager types border, grid and flow.
Event Handling : Events, Event sources, Event classes, Event Listeners, relationship between
Event sources and Listeners, Delegation event model, Example: handling a button click,
handling mouse events, Adapter classes.
Applets Inheritance hierarchy for applets, differences between applets and applications, life
cycle of an applet, passing parameters to applets, applet security issues.
TEXT BOOK
1. Java Fundamentals A comprehensive Introduction, Herbert Schildt and Dale Skrien,
TMH.
REFERENCE BOOKS
1. Java for Programmers, P.J. Deitel and H.M. Deitel, Pearson education (OR) Java: How to
Program P.J.Deitel and H.M. Deitel, PHI.
2. Object Oriented Programming through Java, P. Radha Krishna, Universities Press.
3. Thinking in Java, Bruce Eckel, Peason Education
4. Programming in Java, S. Malhotra and S. Choudary, Oxford Univ. Press.

JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD


II Year B.Tech. CSE-II Sem

T/P/D
-/3/-

C
2

(A40585) JAVA PROGRAMMING LAB


Objectives:
To introduce java compiler and eclipse platform.
To impart hand on experience with java programming.
Note:
Use Linux and MySQL for the Lab Experiments. Though not mandatory, encourage the use of
Eclipse platform.
The list suggests the minimum program set. Hence, the concerned staff is requested to add more
problems to the list as needed.
Use Eclipse or Netbean platform and acquaint with the various menus. Create a test project, and
a test class and run it. See how you can use auto suggestions, auto fill. Try code formatter and
code refactoring like renaming variables, methods and classes. Try debug step by step with a
small program of about 10 to 15 lines which contains at least one if else condition and a for loop.
1. 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 divided by zero.
2. Develop an applet that displays a simple message.
3. Develop an applet that receives an integer in one text field, and computes its factorial
Value and returns it in another text field, when the button named Compute is clicked.
4. Write a program that creates a user interface to perform integer divisions. The user enters
two numbers in the textfields, Num1 and Num2. The division of Num1 and Num2 is
displayed in the Result field when the Divide button is clicked. If Num1 or Num2 were
not an integer, the program would throw a NumberFormatException. If Num2 were Zero,
the program would throw an ArithmeticException. Display the exception in a message
dialog box.
5. 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.
6. Write a Java program that connects to a database using JDBC and does add, delete,
modify and retrieve operations.
7. 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
selected color. Initially there is no message shown.
8. Write a java program to create an abstract class named Shape that contains two integers
and an empty method named printArea(). Provide three classes named Rectangle,
Triangle and Circle such that each one of the classes extends the class Shape. Each one of
the classes contains only the method printArea() that prints the area of the given shape.
9. Suppose that a table named Table.txt is stored in a text file. The first line in the file is the
header, and the remaining lines correspond to rows in the table. The elements are
separated by commas. Write a java program to display the table using Labels in Grid
Layout.
10. 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).
11. Write a Java program that loads names and phone numbers from a text file where the data
is organized as one line per record and each field in a record are separated by a tab (\t). It
takes a name or phone number as input and prints the corresponding other value from the
hash table (hint: use hash tables).
12. Implement the above program with database instead of a text file.
13. Write a Java program that takes tab separated data (one record per line) from a text file
and inserts them into a database.
14. Write a Java program that prints the meta-data of a given table.
TEXT BOOK:
1. Java Fundamentals A comprehensive Introduction, Herbert Schildt and Dale Skrien,
TMH.
REFERENCE BOOKS:
1. Java for Programmers, P.J. Deitel and H.M. Deitel, Pearson education (OR) Java: How to
Program P.J. Deitel and H.M. Deitel, PHI.
2. Object Oriented Programming through Java, P. Radha Krishna, Universities Press.
3. Thinking in Java, Bruce Eckel, Pearson Education.