Está en la página 1de 84

LAB MANUAL

Java Programming Lab

Department of Computer Science and Engineering

Document No:
MLRIT/CSE/LAB MANUAL/Java
programming VERSION 1.1

Date of Issue

Authorized by

29-12-2014

Compiled by
B. Madhuravani
Shiek Gouse

Date of Revision

Verified by

HOD(CSE/IT)

10-01-2015

Saritha Chowdary
Ram Mohan

JAVA PROGRAMMING LAB


OBJECTIVES:
To teach the students basics of JAVA programs and its execution
To teach the students the differences between C++ and JAVA
programming
To make the students learn concepts like packages and interfaces
To make the students understand life cycle of the applets and its
functionality
To make the students understand the usage util package
To teach the student, to develop java programs using interfaces

Recommended System/Software Requirements:


Intel based desktop PC with minimum of 2.6GHZ or faster processor with
at least 256 MB RAM and 40 GB free disk space.
Operating system: Flavor of any WINDOWS
Software: j2sdk1.7
Linux and MySQL
Eclipse or Netbean

INTRODUCTION TO OOP

Object-oriented programming (OOP) is a computer science term used to


characterize a programming language that began development in the 1960s. The
term object-oriented programming was originally coined by Xerox PARC to
designate a computer application that describes the methodology of using objects
as the foundation for computation. By the 1980s, OOP rose to prominence as the
programming language of choice, exemplified by the success of C++. Currently,
OOPs such as Java, J2EE, C++, C#, Visual Basic.NET, Python and JavaScript are
popular OOP programming languages that any career-oriented Software
Engineer or developer should be familiar with.
OOP is widely accepted as being far more flexible than other computer
programming languages. OOPs use three basic concepts as the fundamentals for
the programming language: classes, objects and methods. Additionally,
Inheritance, Abstraction, Polymorphism, Event Handling and Encapsulation are
also significant concepts within object-oriented programming languages that are
explained in online tutorials describing the functionality of each concept in
detail.
The Java platform is undoubtedly fast moving and comprehensive. Its
many application programming interfaces (APIs) provide a wealth of
functionality for all aspects of application and system-level programming. Realworld developers never use one or two APIs to solve a problem, but bring
together key functionality spanning a number of APIs. Knowing which APIs you
need, which parts of which APIs you need, and how the APIs work together to
create the best solution can be a daunting task.

LAB CODE
1. Students should report to the concerned lab as per the time table.
2. Students who turn up late to the labs will in no case be permitted to do the
program schedule for the day.
3. After completion of the program, certification of the concerned staff incharge in the observation book is necessary.
4. Student should bring a notebook of 100 pages and should enter the
readings /observations into the notebook while performing the
experiment.
5. The record of observations along with the detailed experimental
procedure of the experiment in the immediate last session should be
submitted and certified staff member in-charge.
6. Not more than 3-students in a group are permitted to perform the
experiment on the set.
7. The group-wise division made in the beginning should be adhered to and
no mix up of students among different groups will be permitted.
8. The components required pertaining to the experiment should be
collected from stores in-charge after duly filling in the requisition form.
9. When the experiment is completed, should disconnect the setup made by
them, and should return all the components/instruments taken for the
purpose.
10. Any damage of the equipment or burn-out components will be viewed
seriously either by putting penalty or by dismissing the total group of
students from the lab for the semester/year.
11. Students should be present in the labs for total scheduled duration.
12. Students are required to prepare thoroughly to perform the experiment
before coming to laboratory.
13. Procedure sheets/data sheets provided to the students groups should be
maintained neatly and to be returned after the experiment.
4

INDEX
S.n
o.
1

Week
no:

Name of the experiment

PageNo

Write a Java program that works as a simple calculator. 27-34


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.

Develop an applet that displays a simple message.

Develop an applet that receives an integer in one text field, 38-43


and computes its factorial Value and returns it in another
text field, when the button named Compute is clicked
Write a program that creates a user interface to perform 44-48
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.

Use Eclipse or Netbean platform and acquaint with the 9-26


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.

34-37

Write a Java program that implements a multi-thread 49-54


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
Write a Java program that connects to a database using 55-62
JDBC and does add, delete, modify and retrieve operations
Write a Java program that simulates a traffic light. The 63-69
program lets the user select one of three lights: red, yellow,
or green with radio buttons. On selecting a button, an
5

10

11

10

12

11

13

12

14

13

15

14

appropriate message with Stop or Ready or Go


should appear above the buttons in selected color. Initially
there is no message shown
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
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
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)
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)
Implement the above program with database instead of a
text file
Write a Java program that takes tab separated data (one
record per line) from a text file and inserts them into a
database
Write a Java program that prints the meta-data of a given
table

70-76

77-80

81-87

88-93

94-97
98-102

103-106

Installation of Java software:


Steps:
1.
2.
3.
4.

Download JDK7.0 from www.java.sun.com/downloads


Install JDK by double clicking on setup file
Follow the installation wizard.
Upon successful installation the default location where java
is installed is C:\Program Files\Java directory.
5. To compile a java class we have to use javac (java compiler)
6. To execute java program we have to use jvm (java virtual
machine).
7. To use javac and jvm we have to configure environment
variables.
Environment Variables
PATH:
This environment variable is to locate the compiler.
Right click MYCOMPUTER and find a properties tab, Click on
Properties Tab and find Advanced Tab, Click on it to see environment
variables.
In this create a new environment variable called PATH and copy the
location of java compiler as value to it.
Default location:
$PATH= C:\Program Files\Java\Jdk1.6.0\bin;
CLASSPATH:
This environment variable will help the jvm to find the runtime environment
of java i.e. all predefined classes and interfaces can be located using this
variable. The location for runtime environment is JRE folder.
$CLASSPATH= C:\Program Files\Java\Jre\bin;
7

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.
AIM:
To create and test java projects in Eclipse and Netbean platform
Initializing Eclipse
When you develop Java applications in Eclipse, it stores all the created files in a directory
called "workspace". When Eclipse is run for the first time, it will ask you where you want
the workspace to be placed:

You can just use the default location or specify your preferred location. To avoid getting
asked this question every time you start Eclipse, check "Use this as the default and do not
ask again" option and press "OK" button. Once Eclipse finishes its startup process, you

will

see

the

following

welcome

window:

Click the "Workbench" icon on the right, which will lead you to the main Eclipse
window:

Creating a Project
Now that you've got Eclipse up and running, it's time to create your first Java project. To
do this, you'll want to go File -> New -> Java Project. After doing so, you'll see a window
like the following:

Type your project name (say, cs144project1) in the "Project name" field and click Finish.
Then the name of your newly created project will appear on the left side of the Eclipse
window (this part of the window is called "Package explorer pane"):

10

As you create more projects in Eclipse, other project names will appear in the Package
explorer pane and you will be able to switch between your projects by clicking the name
of a project.
Adding a New File to a Project
Now that you've created your first project, you now want to create a new Java file (with
.java extension) and add it into your project. To create a new Java file, right click on the
name of your project (cs144project1) in the Package explorer pane and select New ->
Class as follows:

11

This command will show you a window that looks like the following:

12

In the "Name: " section provide the name of the file (or the class) you want to create,
HelloWorld, and click "Finish" button.

13

Congratulations! Now you have created your first Java code in eclipse. As you can see
from the Package explore pane, your project now includes HelloWorld.java file. The
"Editor pane" to the right of the Package explorer pane shows the actual content of the
HelloWorld.java file, which simply declares HelloWorld as a public class. You can edit
the content of the Java code inside the Editor pane.

Saving, compiling, and running Java code


Now let us learn how to code, compile and run a Java program in Eclipse. First copy and
paste the following method into the HelloWorld class definition:
public static void main(String[] args) {
System.out.println("Hello world!");
}

14

Now save the file by selecting File->Save, or pressing Ctrl-S (Option-S on Mac). When
you save a Java file, Eclipse will automatically compile the file also, so that you don't
need to compile it later when you want to run it.
Now that your code has been saved and compiled, you can run your program by selecting
Run -> Run, or by pressing Ctrl-F11 (Option-F11 on Mac) or by clicking on the "Run"
button
near the top of the window. Once your program finishes running, you will
be able to see the output of your program by selecting the "Console tab" at the bottom of
the window.

15

Quitting Eclipse
You can exit eclipse by using any of the following alternatives:

Hit the X in the upper right corner


Select File -> Exit

Now you have learned the very basic functionality of Eclipse. Eclipse supports many
more functionalities than what you just learned, including integrated debugging and
automatic code completion and method lookup, etc. Please read online Eclipse manual to
learn more about Eclipse.

16

Netbeans
Create an IDE Project
To create an IDE project:
1. Launch the NetBeans IDE.
o On Microsoft Windows systems, you can use the NetBeans IDE item in
the Start menu.
o On Solaris OS and Linux systems, you execute the IDE launcher script by
navigating to the IDE's bin directory and typing ./netbeans.
o On Mac OS X systems, click the NetBeans IDE application icon.
2. In the NetBeans IDE, choose File | New Project....

1. NetBeans IDE with the File | New Project menu item selected.
2. In the New Project wizard, expand the Java category and
Application as shown in the following figure:

select Java

17

1. NetBeans IDE, New Project wizard, Choose Project page.


2. In the Name and Location page of the wizard, do the following (as shown in the
figure below):
o In the Project Name field, type Hello World App.
o In the Create Main Class field, type helloworldapp.HelloWorldApp.

1. NetBeans IDE, New Project wizard, Name and Location page.


2. Click Finish.
18

The project is created and opened in the IDE. You should see the following components:

The Projects window, which contains a tree view of the components of the
project, including source files, libraries that your code depends on, and so on.
The Source Editor window with a file called HelloWorldApp.java open.
The Navigator window, which you can use to quickly navigate between elements
within the selected class.

NetBeans IDE with the HelloWorldApp project open.

Add JDK 8 to the Platform List (if necessary)


It may be necessary to add JDK 8 to the IDE's list of available platforms. To do this,
choose Tools | Java Platforms as shown in the following figure:

19

Selecting the Java Platform Manager from the Tools Menu


If you don't see JDK 8 (which might appear as 1.8 or 1.8.0) in the list of installed
platforms, click Add Platform, navigate to your JDK 8 install directory, and
click Finish. You should now see this newly added platform:

The Java Platform Manager


To set this JDK as the default for all projects, you can run the IDE with the -jdkhome switch on the command line, or by entering the path to the JDK in

20

the netbeans_j2sdkhome property


your INSTALLATION_DIRECTORY/etc/netbeans.conf file.

of

To specify this JDK for the current project only, select Hello World App in
the Projects pane, choose File | Project Properties (Hello World App), click Libraries,
then select JDK 1.8 in the Java Platform pulldown menu. You should see a screen
similar to the following:

The IDE is now configured for JDK 8.

Add Code to the Generated Source File


When you created this project, you left the Create Main Class checkbox selected in
the New Project wizard. The IDE has therefore created a skeleton class for you. You can
add the "Hello World!" message to the skeleton code by replacing the line:
// TODO code application logic here
with the line:
System.out.println("Hello World!"); // Display the string.
Optionally, you can replace these four lines of generated code:

21

/**
*
* @author
*/
with these lines:
/**
* The HelloWorldApp class implements an application that
* simply prints "Hello World!" to standard output.
*/
These four lines are a code comment and do not affect how the program runs. Later
sections of this tutorial explain the use and format of code comments.

Be Careful When You Type

Note: Type all code, commands, and file names exactly as shown. Both the compiler
(javac) and launcher (java) arecase-sensitive, so you must capitalize consistently.
HelloWorldApp is not the same as helloworldapp.

Save your changes by choosing File | Save.


The file should look something like the following:
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package helloworldapp;
/**
* The HelloWorldApp class implements an application that
* simply prints "Hello World!" to standard output.
*/
public class HelloWorldApp {

/**
* @param args the command line arguments
*/
22

public static void main(String[] args) {


System.out.println("Hello World!"); // Display the string.
}
}
Compile the Source File into a .class File
To compile your source file, choose Run | Build Project (Hello World App) from the
IDE's main menu.
The Output window opens and displays output similar to what you see in the following
figure:

Output window showing results of building the HelloWorld project.


If the build output concludes with the statement BUILD SUCCESSFUL, congratulations!
You have successfully compiled your program!
If the build output concludes with the statement BUILD FAILED, you probably have a
syntax error in your code. Errors are reported in the Output window as hyperlinked text.
You double-click such a hyperlink to navigate to the source of an error. You can then fix
the error and once again choose Run | Build Project.
When you build the project, the bytecode file HelloWorldApp.class is generated. You can
see where the new file is generated by opening the Files window and expanding
23

the Hello World App/build/classes/helloworldapp node as shown in the following


figure.

Files window, showing the generated .class file.


Now that you have built the project, you can run your program.
Run the Program
From the IDE's menu bar, choose Run | Run Main Project.
The next figure shows what you should now see.

The program prints "Hello World!" to the Output window (along with other output from
the build script).
Congratulations! Your program works!
Continuing the Tutorial with the NetBeans IDE
The next few pages of the tutorial will explain the code in this simple application. After
that, the lessons go deeper into core language features and provide many more examples.
24

Although the rest of the tutorial does not give specific instructions about using the
NetBeans IDE, you can easily use the IDE to write and run the sample code. The
following are some tips on using the IDE and explanations of some IDE behavior that
you are likely to see:

Once you have created a project in the IDE, you can add files to the project using
the New File wizard. Choose File | New File, and then select a template in the
wizard, such as the Empty Java File template.
You can compile and run an individual file (as opposed to a whole project) using
the IDE's Compile File (F9) and Run File(Shift-F6) commands. If you use
the Run Main Project command, the IDE will run the file that the IDE associates
as the main class of the main project. Therefore, if you create an additional class
in your HelloWorldApp project and then try to run that file with the Run Main
Project command, the IDE will run the HelloWorldApp file instead.
You might want to create separate IDE projects for sample applications that
include more than one source file.
As you are typing in the IDE, a code completion box might periodically appear.
You can either ignore the code completion box and keep typing, or you can select
one of the suggested expressions. If you would prefer not to have the code
completion box automatically appear, you can turn off the feature.
Choose Tools | Options | Editor, click the Code Completion tab and clear
the Auto Popup Completion Window checkbox.
If you want to rename the node for a source file in the Projects window,
choose Refactor from IDE's main menu. The IDE prompts you with
the Rename dialog box to lead you through the options of renaming the class and
the updating of code that refers to that class. Make the changes and
click Refactor to apply the changes. This sequence of clicks might seem
unnecessary if you have just a single class in your project, but it is very useful
when your changes affect other parts of your code in larger projects.

25

WEEK-I
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

AIM:

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.
HARDWARE & SOFTWARE:

Hardware Requirements
Processor
Hard disk Drive
RAM
Keyboard
Monitor
CD ROM
Optical Mouse

Pentium IV
20GB
128MB
111keys Multimedia keyboard
15inches

Software Requirements

Operating System

ZORIN

JAVA

LINUX

2. THEORY:
GridLayout is one of the Layout managers.A layout manager automatically arranges your
controls with in a window by using some type of algorithm.Grid Layout lays out
component in a two dimensional grid. When you instantiate a GridLayout,you define the
number of rows and columns

3. ALGORITHMS:
1.create buttons using Buttons() and text field using TextField()
2.use gridlayout and place the buttons and textfield in this layout by using add()
3.Display the applet showing this.

26

OUTPUT: Compilation: D:\csejava>javac appltcal.java


Interpretation: D:\csejava>appletviewer appltcal.java

4. OBSERVATION:
Input: 2 3 +
Output:
Applet
1
5
9
+

2
6
10
-

3
7

4
8

5. RESULT:
An applet that displays the calculated values

6. INFERENCES:
Execution of applet does not begin at main().The applet will be executed by java
enabled web-browser

7. APPLICATION:
->Web application
->Animations

27

8. EXTENSIONS:
The most important feature of applets on the web, however, is th fact that applets change
the web from being a static medium to one based on interactivity with users.at
present,java is limited only by the capabilities of the internet itself .as the internet grows
in data transmission,java is ready to expand with it.

9. DIAGNOSTICS:
S.NO
1.

Error
Error:Missing semicolon

2.

Exception :Arithmetic Exception

Error:cannot read

4.

Error: Package system doesnot exist

Debugging
Go to the line number and
place semicolon at the end
of the statement
Dont divide the number
with zero
Make sure that the file is
present in the directory in
which u are executing it
Write the first character of
the System in capital letters

10 .QUESTIONS:
1.___________automatically arranges the controls the with in the window.
2.The controls cannot be arrange manually because of _________.
3.Layout managers are used when ________ and __________ information is not
available when u need to arrange the control.
4.Each __________ object has a layout manager associated to it.
5.A layout manager is an instance of any class that implements the _________interface.
6.The layout manager is set using ________ method.
7.if no call to setLayout() is made then the ___________ manger is used.
8.you can determine the shape and position of each component manually using ________
9.The _________ is notified when a new component is added to the container.
10.Each component managed by the Layout manager contains the ________ and
__________Methods.

28

PROBLEM DEFINITIONS DIFFERENT FROM JNTU TOPICS


S
No

Problem
statemen
t
No
P1

P2

P3

P4

P5

P6

P7

P8

P9

10

P10

Name of the Experiment

Batch1
No

Batch2
No

Write a Java program that works as a simple calculator. Use a grid


layout to arrange buttons for the digits and for the +,-,*,/,% and sine
operations. Add a text field to display the result. Handle any possible
exceptions.
Write a Java program that works as a simple calculator. Use a grid
layout to arrange buttons for the digits and for the +,-,*,/,% and
cosine operations. Add a text field to display the result. Handle any
possible exceptions.
Write a Java program that works as a simple calculator. Use a grid
layout to arrange buttons for the digits and for the +,-,*,/,% and tan
operations. Add a text field to display the result. Handle any possible
exceptions.
Write a Java program that works as a simple calculator. Use a grid
layout to arrange buttons for the digits and for the <,>,<=,>=,== and
!= operations. Add a text field to display the result. Handle any
possible exceptions.
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.
Write a Java program that works as a simple calculator. Use a grid
layout to arrange buttons for the digits and for the +,-,*,/,% and sqrt
operations. Add a text field to display the result. Handle any possible
exceptions.
Write a Java program that works as a simple calculator. Use a grid
layout to arrange buttons for the digits and for the +,-,*,/,% and
square operations. Add a text field to display the result. Handle any
possible exceptions.
Write a Java program that works as a simple calculator. Use a grid
layout to arrange buttons for the digits and for the +,-,*,/,% and pow
operations. Add a text field to display the result. Handle any possible
exceptions.
Write a Java program that works as a simple calculator. Use a grid
layout to arrange buttons for the digits and for the +,-,*,/,% and ceil
operations. Add a text field to display the result. Handle any possible
exceptions.
Write a Java program that works as a simple calculator. Use a grid
layout to arrange buttons for the digits and for the +,-,*,/,% and floor
operations. Add a text field to display the result. Handle any possible
exceptions.

A1

B1

A2

B2

A3

B3

A4

B4

A5

B5

A6

B6

A7

B7

A8

B8

A9

B9

A10

B10

29

WEEK-2
Develop an applet that displays a simple message
1. AIM:
Java program to display a simple message.
HARDWARE & SOFTWARE:

Hardware Requirements
Processor
Hard disk Drive
RAM
Keyboard
Monitor
CD ROM
Optical Mouse

Pentium IV
20GB
128MB
111keys Multimedia keyboard
15inches

Software Requirements

Operating System

ZORIN

JAVA

LINUX

3. THEORY:
Applets are designed to bring the web alive.they function to add animation sound and
eventually complete multi media into HTML documents.java is also part of the future of
interfacing with virtual-reality environments implemented via VRML.At present ,java is
limited only by the capabilities of the internet itself.applets are java programs that are
specialized for use over the Web.

3. ALGORITHMS:
1.create an applet from extending applet class.
2.using drastic method in paint() display the simple message.
3.include the applet program in the HTML code
4.Execute the applet using web-browser.

Output: Compilation: D:\cse>javac applt.java


Interpretation: D:\cse>appletviewer applt.java
30

4. OBSERVATION:
Input:
Applet ,

Sample text

5. RESULT:
An applet that displays a simple messages

6. INFERENCES:
Execution of the applet does not begin at main().The applet will be executed by
java enabled web-browser.

7. APPLICATION:
->Web application
->Animations

8. EXTENSIONS:
31

The most important feature of applets on the web, however, is th fact that applets
change the web from being a static medium to one based on interactivity with users.at
present,java is limited only by the capabilities of the internet itself .as the internet grows
in data transmission,java is ready to expand with it.

9.DIAGNOSTICS:
S.NO
1.

Error
Error:Missing semicolon

2.

Exception :Arithmetic Exception

Error:cannot read

4.

Error: Package system doesnot exist

Debugging
Go to the line number and
place semicolon at the end
of the statement
Dont divide the number
with zero
Make sure that the file is
present in the directory in
which u are executing it
Write the first character of
the System in capital letters

10. QUESTIONS:
1.All applets must import _________
2.AWT stands for_________
3.Applets are executed by _____________
4.Execution of applets does not begin at____________
5.An applet is included in the HTML file using __________tag.
6.___________outputs the string to the specified X,Y location.
7.Applets provides all necessary support for ___________
8.Applets are ___________
9.user initiates interaction with the_____________
10.An applets waits until ___________ occurs.

32

PROBLEM DEFINITIONS DIFFERENT FROM JNTU TOPICS


S Problem
No statemen
t
No

Name of the Experiment

Batch-1
No

Batch-2
No

P1

Develop an applet that displays student information

A1

B1

P2

Develop an applet that draw and fill Rectangle

A2

B2

P3

Develop an applet that draw and fill Circle

A3

B3

P4

Develop an applet that draw and fill Oval

A4

B4

P5

Develop an applet that draw and fill Arc

A5

B5

P6

Develop an applet that draw and fill Polygon

A6

B6

P7

Develop an applet that draw Lines

A7

B7

P8

Develop an applet that draw and fill RoundRectangle

A8

B8

P9

Develop an applet that diplays a message using different font type

A9

B9

10

P10

Develop an applet that displays a message and draw a rectangle.

A10

B10

33

WEEK -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.

1 .AIM:
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
HARDWARE & SOFTWARE:

Hardware Requirements
Processor
Hard disk Drive
RAM
Keyboard
Monitor
CD ROM
Optical Mouse

Pentium IV
20GB
128MB
111keys Multimedia keyboard
15inches

Software Requirements

Operating System

ZORIN

JAVA

LINUX

2.THEORY:
Applets are designed to bring the web alive.they function to add animation sound and
eventually complete multi media into HTML documents.java is also part of the future of
interfacing with virtual-reality environments implemented via VRML.At present ,java is
limited only by the capabilities of the internet itself.applets are java programs that are
specialized for use over the Web.
The Appplet life cycle
The init()Method: The init()method is where your applet does much of its setup,such as
defined its layout,parsing parameters,or setting the background colors.
The starts() Method: The start()method is used mainly when implementing threads in
java.
The stop() Mehtod: The stop() method is used to do what its name suggests: stop what is
going on.
The destroy() method: when it is called,the applet is told to free up system resources.

3. ALGORITHMS:
1.create an applet from extending applet class.
2 get the parameters from the browser using getParameter() for monthly rate.
3.Calculate the amount of loan.
34

4.Include the applet in html and set the parameter using param and value pair.
5.Run the applet in the browser.

OUTPUT: Compilation: E:\ADITYA\csejava>javac appltfact.java


Interpretation: D:\cse java>appletviewer appltfact.java

4. OBSERVATION:
Input: 2
Output:
Applet
5 is 20

5. RESULT:
An applet that displays the fctorial of a number

6. INFERENCES:
Execution of applet does not begin at main().The applet will be executed by java
enabled web-browser

7. APPLICATION:
->Web application
35

->Animations

8. EXTENSIONS:
The most important feature of applets on the web, however, is th fact that applets change
the web from being a static medium to one based on interactivity with users.at
present,java is limited only by the capabilities of the internet itself .as the internet grows
in data transmission,java is ready to expand with it.

9. DIAGNOSTICS:
S.NO
1.

Error
Error:Missing semicolon

2.

Exception :Arithmetic Exception

Error:cannot read

4.

Error: Package system doesnot exist

Debugging
Go to the line number and
place semicolon at the end
of the statement
Dont divide the number
with zero
Make sure that the file is
present in the directory in
which u are executing it
Write the first character of
the System in capital letters

10. QUESTIONS:
1.Applet can be executed by a _________ and _________
2.The __________ tag is used to start an applet from both HTML document and from an
applet viewer.
3.Applet viewer will execute each APPLET tag in __________ window.
4.Web browsers will allow _________ applet tag in a single page.
5.________ attribute specifies the base URL of the applet code.
6._________ is a required attribute that gives tha name of the file containing applets
compiled code.
7.___________ and ________ are required attributes that gives the size .
8.getParameters is used to return_________
9.getParameter returns the specified parameter in _______ object.
10.________tag allows to specify applet specifies argument in HTML page.

36

PROBLEM DEFINITIONS DIFFERENT FROM JNTU TOPICS


S Problem
No statemen
t
No
1

P1

P2

P3

P4

P5

P6

P7

P8

P9

10

P10

Name of the Experiment

Batch-1
No

Batch-2
No

Develop an applet that receives an integer in one text field, and


check whether the entered number is even or odd, when the button
named even.odd is clicked
Develop an applet that receives an integer in one text field, and
check whether the entered number is armstrong or not, when the
button named Armstrong is clicked
Develop an applet that receives an integer in one text field, and
print the sum of individual digits, when the button named Sum
is clicked
Develop an applet that receives an integer in one text field, and
check whether the number is prime or not, when the button named
Prime is clicked
Develop an applet that receives an integer in one text field, and
check whether the number is perfect or not, when the button
named Perfect is clicked
Develop an applet that receives an integer in one text field, and
print the digital root, when the button named Digital root is
clicked
Develop an applet that receives an integer in one text field, and
check whether the number is palindrome or not, when the button
named palindrome is clicked
Develop an applet that receives an integer in one text field, and
print the reverse of it, when the button named reverse is clicked
Develop an applet that receives an integer in one text field, and
print the sum of squares of individual digits, when the button
named Sum is clicked.
Develop an applet that receives an integer in one text field, and
print the sum of cubes of individual digits, when the button named
Sum is clicked.

A1

B1

A2

B2

A3

B3

A4

B4

A5

B5

A6

B6

A7

B7

A8

B8

A9

B9

A10

B10

37

WEEK-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.

1.AIM:
Program to create 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.
HARDWARE & SOFTWARE:

Hardware Requirements
Processor
Hard disk Drive
RAM
Keyboard
Monitor
CD ROM
Optical Mouse

Pentium IV
20GB
128MB
111keys Multimedia keyboard
15inches

Software Requirements

Operating System

Windows XP

JAVA

Version XP

2.THEORY:
The AWT supports a rich assortment of graphics methods.All graphics are drawn relative
to a window.this can the main windowof an applet, a child window of an applet,or a stand
alone application window. The origin of each window is at the top-left corner and is 0,0
cordinates are specified in pixels.All output to a window takes place through a graphics
context.

3.ALGORITHMS:
1. create an applet from extending Applet class.
2. Draw a line using drawLine()method.
3.Draw rectangle using drawRec() method.
4.Draw an ovel using drawOvel()method.
5.Include all these methods in the paint()method.
38

6.Display the line.rectangle and ovel.

Output: Compilation: D:\csejava>javac Divide.java


Interpretation: D:\csejava>appletviewer Divide.java

4.OBSERVATION:
Input: applet
Output:
Applet

Diagrams will display

5.RESULT:The above window will bw displayed.


6.INFERENCES:
The graphics class defines a number of drawing functions.Each shape can be
drawn edge-only or filled. Objects are drawn and filled in the currently selected graphics
color,which is black by default

7.APPLICATION:
->GUI application
-> Web application

8.EXTENSIONS:
We can use Graphics class to draw various shapes and also to color
39

9.DIAGNOSTICS:
S.NO
1.

Error
Error:Missing semicolon

2.

Exception :Arithmetic Exception

Error:cannot read

4.

Error: Package system doesnot exist

Debugging
Go to the line number and
place semicolon at the end
of the statement
Dont divide the number
with zero
Make sure that the file is
present in the directory in
which u are executing it
Write the first character of
the System in capital letters

10.QUESTIONS:
1.setVisible() is used for __________
2.the title of the frame window can be changed using_________
3.The lines are drawn by means of ___________ method.
4._________displays an outlined rectangle.
5._________method displays a filled rectangle.
6.to draw rounded rectangle _________ method is used.
7.The delimiter of the rounding are along the x-axis is specified by _________
8. The delimiter of the rounding are along the x-axis is specified by _________
9.the dimensions of the rectangle are specified by _________ and _________
10.To draw an eclipse a ___________ method is used.

40

PROBLEM DEFINITIONS DIFFERENT FROM JNTU TOPICS


S Problem
No statemen
t
No

Name of the Experiment

Batch-1
No

Batch-2
No

P1

Develop an applet that creates a user interface to perform


float 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 float , the program would
throw a NumberFormatException. If Num2 were Zero, the
program would throw an ArithmeticException. Display the
exception in a message dialog box.

A1

B1

P2

A2

B2

P3

A3

B3

P4

Develop an applet that creates a user interface to check for


array index out of bound exception
Develop an applet that creates a user interface to check for
class not found Exception
Develop an applet that creates a user interface to check for

A4

B4

A5

B5

A6

B6

A7

B7

A8

B8

A9

B9

A10

B10

NegativeArraySizeException

P5

P6

Develop an applet that creates a user interface to check for


NullPointerException

Develop an applet that creates a user interface to check for


NoSuchMethodException

P7

P8

P9

Develop an applet that creates a user interface to check for


array index out of bound exception
Develop an applet that creates a user interface to check for
class not found Exception
Develop an applet that creates a user interface to check for
NullPointerException

10

P10

Develop an applet that creates a user interface to check for


NoSuchMethodException

41

WEEK-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

1.AIM:

Creating 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
HARDWARE & SOFTWARE:

Hardware Requirements
Processor
Hard disk Drive
RAM
Keyboard
Monitor
CD ROM
Optical Mouse

Pentium IV
20GB
128MB
111keys Multimedia keyboard
15inches

Software Requirements

Operating System

Windows XP

JAVA

Version XP

2.THEORY:
The java run-time system depends on the threads for many things, and all the class
libraries are designed with multithreading in mind. In fact,java uses threads to enable the
entire environment to be asynchronous.This helps reduce inefficiency by preventing the
waste of CPU cycles.
The benefits of javas multithreading is that the main loop/polling mechanism is
eliminated.one thread can pause without stopping other parts of your program.when a
thread blocks in ajava program,only the single thread that is blocked pauses.All other
threads continue to run.

3. ALGORITHMS:
1Create a thread class by implementing the Runnable interface.
2.Start the thread in the constructor.
42

3.implement the run() method.


4.create multiple threads in the main() method
5.Display the threads

Output: Compilation: D:/csejava>javac multhreadss.java


Interpretation: D:\csejava>java multhreadss

4. OBSERVATION:
Input:
Output:
Square: 4
Cube : 21.
5. RESULT:
The values of the thread is executing will be printed

6. INFERENCES:
Multithreading is used to open several tasks simultaneously.Multithreading can be
implementing using Runnable interface or extending from Thread class

7. APPLICATION:
->Multitasking
->Multiprogramming

8. EXTENSIONS:
Priorities can also be assigned to the threads based on which the execution of
which thread first is decided

9.DIAGNOSTICS:
S.NO
1.

Error
Error:Missing semicolon

2.

Exception :Arithmetic Exception

Error:cannot read

Debugging
Go to the line number and
place semicolon at the end
of the statement
Dont divide the number
with zero
Make sure that the file is
present in the directory in
43

4.

Error: Package system doesnot exist

which u are executing it


Write the first character of
the System in capital letters

10. QUESTIONS:
1.A multi thread programs contains two or more parts thet can run _________
2.A process is a program that is ____________
3.Multitasking threads require ___________ over head than multitasking process.
4.process are _________ tasks.
5.threads are _________ tasks.
6.Multithreading makes the maximum use of __________
7.___________ share the same address space.
8.A thread can be _________ when waiting for a resource.
9.A thread can be terminated which halts its _________
10.Contexts to switch is _________.

PROBLEM DEFINITIONS DIFFERENT FROM JNTU TOPICS


S Problem
No statemen
t
No

Name of the Experiment

Batch-1
No

Batch-2
No

P1

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

A1

B1

P2

Write a Java program that implements a multi-thread application


that has three threads. First thread generates random integer every
100 second and if the value is odd, second thread computes the
cube of the number and prints. If the value is even, the third
thread will print the value of square of the number

A2

B2

P3

Write a Java program that implements a multi-thread application


that has three threads. First thread generates random integer every
100 second and if the value is odd, second thread computes and
prints Good. If the value is even, the third thread will print
Morning

A3

B3

44

P4

Write a Java program that creates three threads. First thread


displays Good Morning every one second, the second thread
displays Hello every two seconds and the third thread displays
Welcome every three seconds.

A4

B4

P5

Write a Java program that creates three threads. First thread


displays Good Morning every 10 second, the second thread
displays Hello every 20 seconds and the third thread displays
Welcome every 30 seconds.

A5

B5

P6

Write a Java program that implements a multi-thread application


that has three threads. First thread generates random integer every
1second and if the value is less than 50, second thread computes
and prints Good. If the value is greater than 50 , the third thread
will print Morning

A6

B6

P7

Write a Java program that implements a multi-thread application


that has three threads. First thread generates random integer every
10 second and if the value is odd, second thread computes the
factorial of the number and prints. If the value is even, the third
thread will print the value of square of the number

A7

B7

P8

Write a Java program that implements a multi-thread application


that has three threads. First thread generates random integer every
10 second and if the value is odd, second thread computes the sqrt
of the number and prints. If the value is even, the third thread will
print the number.

A8

B8

P9

Write a Java program that creates three threads. First thread


displays Good every one second, the second thread displays
Hello every four seconds and the third thread displays
Welcome every six seconds.

A9

B9

10

P10

Write a Java program that implements a multi-thread application


that has three threads. First thread generates random integer every
1second and if the value is in between 1 to 50 , second thread
computes and prints Good. If the value is in between 50 to 100 ,
the third thread will print Morning

A10

B10

45

WEEK-6
Write a Java program that connects to a database using JDBC and does add, delete,
modify and retrieve operations

1.AIM:
Creating a Java program that connects to a database using JDBC and does add, delete,
modify and retrieve operations
HARDWARE & SOFTWARE:

Hardware Requirements
Processor
Hard disk Drive
RAM
Keyboard
Monitor
CD ROM
Optical Mouse

Pentium IV
20GB
128MB
111keys Multimedia keyboard
15inches

Software Requirements

Operating System

Windows XP

JAVA

Version XP

2.THEORY:
JDBC is a Java database connectivity technology (Java Standard Edition
platform) from Oracle Corporation. This technology is an API for
the Java programming language that defines how a client may access a
database. It provides methods for querying and updating data in a database.

3. ALGORITHMS:
1Create a class by to connect to the database.
2.insert statement is implemented.
3.implement the select statement .
4.create the update statement
5.implement the delete statement

46

Output: Compilation: D:/csejava>javac JavaJdbc.java


Interpretation: D:\csejava>java JavaJdbc

4. OBSERVATION:
Input:
Output:
Opened database successfully
Records created successfully
ID = 1
NAME = Paul
AGE = 32
ADDRESS = California
SALARY = 20000.0
ID = 2
NAME = Allen
AGE = 25
ADDRESS = Texas
SALARY = 15000.0

5. RESULT:
The values of the inserted can be retrieved.

6. INFERENCES:
With the help of JDBC connectivity we can perform operation on Java
applications

7. APPLICATION:
-> Java user interface Applications

8. EXTENSIONS:
Commit &Rollback operations also can be performed .

9.DIAGNOSTICS:
S.NO

Error

Debugging
47

1.

Error:Missing semicolon

2.
3

Exception :Existence of Table


Error:cannot find the data

4.

Error: Package system doesnot exist

Go to the line number and


place semicolon at the end
of the statement
Table is to be created
Make sure that the datais
present in the table in which
u are executing it
Write the first character of
the System in capital letters

10. QUESTIONS:
1. How many JDBC driver types does Sun define?_______
2. ________ is an open source DBMS product that runs on UNIX, Linux and Windows.
3. ___________JDBC driver Type(s) is(are) the JDBC-ODBC bridge?
4. JDBC stands for____________
5. The ............................. package contains classes that help in connecting to a database,
sending SQL statements to the database, and processing the query results.
6.The ................................ method executes a simple query and returns a single Result
Set object.
7.The ......................... method executes an SQL statement that may return multiple
results.
8. The ........................ object allows you to execute parametrized queries.
9. The .................. object provides you with methods to access data from the table.
10. The parameters of the PreparedStatement object are ...................... when the user
clicks on the Query button.

PROBLEM DEFINITIONS DIFFERENT FROM JNTU TOPICS


S Problem
No statemen
t
No
1

P1

P2

P3

Name of the Experiment

Batch-1
No

Batch-2
No

Creating a Java program that connects to a database using JDBC

A1

B1

A2

B2

A3

B3

A4

B4

A5

B5

To create a table
Creating a Java program that connects to a database using JDBC
Write a java program to retrieve an employe salary by its Id
Creating a Java program that connects to a database using JDBC
Write a java program to update an employe salary by its Id

P4

P5

Creating a Java program that connects to a database using JDBC


Write a java program to modify the Date of Address employee

Creating a Java program that connects to a database using JDBC


Write a java program to Delete the data of employe whose id is 123

48

P6

P7

P8

P9

10

P10

Creating a Java program that connects to a database using JDBC


Write a java program to modify the Date of Address employee
Creating a Java program that connects to a database using JDBC
Write a java program to modify the Name of the employe
Creating a Java program that connects to a database using JDBC
Write a java program to update age of the employe withid 123
Creating a Java program that connects to a database using JDBC
Write a java program to insert the Data of new employe
Creating a Java program that connects to a database using JDBC
Write a java program to modify the Address of new employe

A6

B6

A7

B7

A8

B8

A9

B9

A10

B10

49

Week-7
JNTUH Program
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.
1.AIM:
write a java program that simulates trafficlight the program let user select one of three
lights ,thread yellowor green .when a radio button is select the light is turn ed one light
can be on at atime. No lights is on when the program starts.
HARDWARE & SOFTWARE:
Hardware Requirements
Processor
Hard disk Drive
RAM
Keyboard
Monitor
CD ROM
Optical Mouse

Pentium IV
20GB
128MB
111keys Multimedia keyboard
15inches

Software Requirements
Operating System
JAVA

Windows XP
Version XP

2.THEORY:
The AWT supports a rich assortment of graphics methods.All graphics are drawn relative
to a window.this can the main windowof an applet, a child window of an applet,or a stand
alone application window. The origin of each window is at the top-left corner and is 0,0
cordinates are specified in pixels.All output to a window takes place through a graphics
context.
3.ALGORITHMS:
1. create an applet from extending Applet class.
2. Draw a line using drawLine()method.
3.Draw rectangle using drawRec() method.
4.Draw an ovel using drawOvel()method.
5.Include all these methods in the paint()method.
6.Display the line.rectangle and ovel.

50

Output:

Initial

READY

GO

STOP
4.OBSERVATION:
Input: applet
Output:
Applet

Diagrams will display

51

5.RESULT:
The above window will bw displayed.
6.INFERENCES:
The graphics class defines a number of drawing functions.Each shape can be drawn edge-only or
filled. Objects are drawn and filled in the currently selected graphics color,which is black by default
7.APPLICATION:
->GUI application
-> Web application
8.EXTENSIONS:
We can use Graphics class to draw various shapes and also to color
9.DIAGNOSTICS:
S.NO
1.

Error
Error:Missing semicolon

2.

Exception :Arithmetic Exception

Error:cannot read

4.

Error: Package system doesnot exist

Debugging
Go to the line number and place
semicolon at the end of the
statement
Dont divide the number with
zero
Make sure that the file is present
in the directory in which u are
executing it
Write the first character of the
System in capital letters

10.QUESTIONS:
1.setVisible() is used for __________
2.the title of the frame window can be changed using_________
3.The lines are drawn by means of ___________ method.
4._________displays an outlined rectangle.
5._________method displays a filled rectangle.
6.to draw rounded rectangle _________ method is used.
7.The delimiter of the rounding are along the x-axis is specified by _________
8. The delimiter of the rounding are along the x-axis is specified by _________
9.the dimensions of the rectangle are specified by _________ and _________
10.To draw an eclipse a ___________ method is used.

52

PROBLEM DEFINITIONS DIFFERENT FROM JNTU TOPICS


S
Problem
Name of the Experiment
No statement
No
1

P1

P2

P3

P4

P5

P6

P7

P8

Write a Java program that simulates a Branch selection. The


program lets the user select one of three branches: CSE , ECE,
MECH ,AERO with radio buttons. On selecting a button, an
appropriate message with CSE or ECE or MECH or
AERO should appear above the buttons in selected color.
Initially there is no message shown.
Write a Java program that simulates a Branch Codes. The program
lets the user select one of three branche codes :5, 4 ,3 ,12 with
radio buttons. On selecting a button, an appropriate message with
CSE or ECE or MECH or IT should appear above the
buttons in selected color. Initially there is no message shown.
Write a Java program that simulates a Operators. The program lets
the user select one of three branches: ADD,SUB & DIV with radio
buttons. On selecting a button, an appropriate message with + or
- or / should appear above the buttons in selected color.
Initially there is no message shown.
Write a Java program that simulates a Animals . The program lets
the user select one of three branches: G,D & C with radio buttons.
On selecting a button, an appropriate message with GOAT or
DOG or CAT should appear above the buttons in selected
color. Initially there is no message shown.
Write a Java program that simulates a Programming . The
program lets the user select one of three branches: Structural ,
Partial Object-Oriented & Pure OOP with radio buttons. On
selecting a button, an appropriate message with C or C++ or
Java should appear above the buttons in selected color. Initially
there is no message shown.
Write a Java program that simulates a Operating Systems. The
program lets the user select one of three branches: Windows,
Andriod, IOS with radio buttons. On selecting a button, an
appropriate message with Nokia Lumina or Samsung or
iPhone should appear above the buttons in selected color.
Initially there is no message shown.
Write a Java program that simulates a Text Books. The program
lets the user select one of three branches: C,C++ & JAVA with
radio buttons. On selecting a button, an appropriate message with
Fourazan or Shani or Herbert Shild should appear above the
buttons in selected color. Initially there is no message shown.
Write a Java program that simulates social websites. The program
lets the user select one of three branches: Face Book ,Twitter
& WhatsApp with radio buttons. On selecting a button, an
appropriate message with Mark Zuckerberg or Jack Dorsey
or Brian Acton and Jan Koum should appear above the buttons

Batch-1
No

Batch-2
No

A1

B1

A2

B2

A3

B3

A4

B4

A5

B5

A6

B6

A7

B7

A8

B8

53

in selected color. Initially there is no message shown.


9

P9

10

P10

Write a Java program that simulates Cricketers . The program lets


the user select one of three country : INIDA ,Australia &
England with radio buttons. On selecting a button, an appropriate
message with Dhoni or Michael Craclke or Cook should
appear above the buttons in selected color. Initially there is no
message shown.
Write a Java program that simulates Countries . The program lets
the user select one of three capitals : INDIA , USA &
JAPAN with radio buttons. On selecting a button, an appropriate
message with Delhi or Washing ton or Tokyo should
appear above the buttons in selected color. Initially there is no
message shown.

A9

B9

A10

B10

54

WEEK-8
JNTUH Program-8
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.
1.AIM:
Write a java program to create an abstract class that illustrates different geometrical figures.
HARDWARE & SOFTWARE:
Hardware Requirements
Processor
Hard disk Drive
RAM
Keyboard
Monitor
CD ROM
Optical Mouse

Pentium IV
20GB
128MB
111keys Multimedia keyboard
15inches

Software Requirements
Operating System
JAVA

Windows XP
Version XP

2. THEORY:
To create an abstract class that shows the hiding of elements in a class. At the same time inheritance
property is used to extend the class shape into different geometrical figures. This represents the
reusability of code for a programmer.
3. ALGORITHMS:
1.
2.
3.
4.
5.
6.

Create abstract class shape


Declare two integer variables
Declare abstract method printArea()
Create a sub classes Rectangle, Triangle and Circle that extends shape
Implement the printArea().
Invoke both the methods in the main class by objects

55

OUTPUT:

56

4. OBSERVATION:
Input: 1
Output: Prints the Rectangle Area
Input: 2
Output: Prints the Triangle Area
Input:
Output: Prints the Circle Area

57

5. RESULT:
The method in the subclasses will be displayed.
6. INFERENCES:
By abstracting we can hide the required data and implement in many classes by extending the
abstract class.
7. APPLICATION:
-> abstraction implementation
-> Inheritance implementation
8. EXTENSIONS:
Inheritance and abstractions are used

58

9. DIAGNOSTICS:
S.NO
1.

Error
Error: Missing semicolon

2.

Exception :Arithmetic Exception

Error: cannot read

4.

Error: Package system does not exist

Debugging
Go to the line number and place
semicolon at the end of the
statement
Dont divide the number with
zero
Make sure that the file is present
in the directory in which u are
executing it
Write the first character of the
System in capital letters

10. QUESTIONS:
1. Polymorphism is a feature that allows _________
2. Polymorphism is expressed by the phrases one interface _______ methods.
3. Method override is the basis_________.
4. Java implements ________ using dynamic method dispatch.
5. A super class reference variable can refer to a __________ object.
6. The type of object being referred to determines which version of an ________method.
7. Override methods allows java to support _________
8. Method override occurs only when the names and the type signature of the two methods
are___________
9. When a method in the subclass has the same name and type as the method in the super class then the
method in the subclass is said to _________ the method in the super class.
10. Difference between overloading and overriding is __________

59

PROBLEM DEFINITIONS DIFFERENT FROM JNTU TOPICS


S
No

Problem
statement
No

P1

P2

P3

P4

P5

P6

P7

P8

P9

10

P10

Name of the Experiment


Write a java program to create an abstract class named Shape that
contains two integers and an empty method named
printPerimeter(). Provide three classes named Square , Triangle
and Circle
Write a java program to create an abstract class named Shape that
contains two integers and an empty method named printVolume().
Provide three classes named Cube , Sphere & Cylinder
Write a java program to create an abstract class named Shape that
contains two integers and an empty method named
printTotalSurfaceArea(). Provide three classes named Cube ,
Sphere & Cylinder
Write a java program to create an abstract class named Shape that
contains two integers and an empty method named
printArithemeticOperations (). Provide three operation ADD,
SUB & DIV
Write a java program to create an abstract class named Fact that
contains two integers and an empty method named
printFactorial(). Provide three classes named Factorial , pnr & ncr
Write a java program to create an abstract class named HCF that
contains two integers and an empty method named printValue().
Provide three classes named GCD & LCM
Write a java program to create an abstract class named
MathFunctions that contains two integers and an empty method
named printResult(). Provide three classes named Square , Cube
and Power
Write a java program to create an abstract class named Functions
that contains two integers and an empty method named
DisplayResult(). Provide three classes named Even Odd and
Prime
Write a java program to create an abstract class named
MathFunctions that contains two integers and an empty method
named printResult(). Provide three classes named Square , Cube
and Power
Write a java program to create an abstract class named
NumberTesting that contains two integers and an empty method
named checkReverse(). Provide three classes named Reverse &
Palindrome

Batch-1
No

Batch-2
No

A1

B1

A2

B2

A3

B3

A4

B4

A5

B5

A6

B6

A7

B7

A8

B8

A9

B9

A10

B10

60

WEEK-9
JNTUH Program -9
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
1. AIM:
Write a java program to display the table using Grid Layout component
HARDWARE & SOFTWARE:
Hardware Requirements
Processor
Hard disk Drive
RAM
Keyboard
Monitor
CD ROM
Optical Mouse

Pentium IV
20GB
128MB
111keys Multimedia keyboard
15inches

Software Requirements
Operating System
JAVA

Windows XP
Version XP

2. THEORY:
To create an table and display it using JTable components
3. ALGORITHMS:
1.create a class myjtable
2.declare a new Grid Layout
3.set default data and create columns
4.create new scroll pane and table
5.set the size and set visible methods

61

Output:

4. OBSERVATION:
Input: text file name
Output: table
5. RESULT:
The table will be displayed from given text file
6. INFERENCES:
By using JComponents we can display in required form
7. APPLICATION:
-> jscrollpane implementation
-> jcomponents implementation
8. EXTENSIONS:
Swings concepts are used
9. DIAGNOSTICS:
S.NO
Error
1.
Error:Missing semicolon

2.

Exception :Arithmetic Exception

Error:cannot read

4.

Error: Package system doesnot exist

Debugging
Go to the line number and place
semicolon at the end of the
statement
Dont divide the number with
zero
Make sure that the file is present
in the directory in which u are
executing it
Write the first character of the
System in capital letters

10. QUESTIONS:
1. polymorphism is a feature that allows _________
2. polymorphism is expressed by the phrases one interface _______ methods.
3.Method override is the basis_________.
4.Java implements ________ using dynamic method dispatch.
5.A super class reference variable can refer to a __________ object.
6.The type of object being referred to determines which version of an _________ method.
7. Override methods allows java to support _________
62

8. Method override occurs only when the names and the type signature of the two methods
are___________
9. When a method in the subclass has the same name and type as the method in the super class then the
method in the subclass is said to _________ the method in the super class.
10. Difference between overloading and overriding is __________
PROBLEM DEFINITIONS DIFFERENT FROM JNTU TOPICS
S Problem
Name of the Experiment
No statemen
t
No
Suppose that a table named StudentTable.txt is stored in a text file.
1
P1
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
JTable.
Suppose that a table named EmployeeTable.txt is stored in a text
2
P2
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
Suppose that a table named Employee Table.txt is stored in a text
3
P3
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
JTable.
Suppose that a table named VehicleTable.txt is stored in a text file.
4
P4
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
Suppose that a table named VehicleTable.txt is stored in a text file.
5
P5
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
JTable.
Suppose that a table named AnimalTable.txt is stored in a text file.
6
P6
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
Suppose that a table named AnimalTable.txt is stored in a text file.
7
P7
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
JTable.
Suppose that a table named MarksTable.txt is stored in a text file.
8
P8
The first line in the file is the header, and the remaining lines
correspond to rows in the table. The elements are separated by

Batch1
No

Batch2
No

A1

B1

A2

B2

A3

B3

A4

B4

A5

B5

A6

B6

A7

B7

A8

B8

63

commas. Write a java program to display the table using Labels in


Grid Layout.
9

P9

10

P10

Suppose that a table named MarksTable.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
JTable.
Suppose that a table named FacultyTable.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.

A9

B9

A10

B10

64

WEEK-10
JNTUH Program-10
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).
1. AIM:
Write a java program for handling mouse events
HARDWARE & SOFTWARE:
Hardware Requirements
Processor
Hard disk Drive
RAM
Keyboard
Monitor
CD ROM
Optical Mouse

Pentium IV
20GB
128MB
111keys Multimedia keyboard
15inches

Software Requirements
Operating System
JAVA

Windows XP
Version XP

2. THEORY:
To handle mouse events you must implement the MouseListener and the MouseMotionListener
interfaces.These two interfaces contain methods that receive and process the various types of mouse
events.
3. ALGORITHMS:
1create an applet extending from an applet class
2. In the init()method add both MouseListener and MouseMotionListener.
3. Extends the MouseAdapter and MouseMotionAdapter classes
3.Override the following
a) mouseClicked
b) mouseEntered
c) mouseExited
d)mousePressed
e) mouseReleased
f) mouseDregged
g)mouse Moved
4. Using showStatus method get the message .
5. Display the information on the screen.

65

OUTPUT:

66

4. OBSERVATION:
Input: press the mouse button on the applet
Output:
Applet |

Down

5. RESULT:
The above screen should be displayed.
6. INFERENCES:
MouseListener and MouseMotionListener are the interfaces to implement all the
methods for the mouse events.
7. APPLICATION:
->Web application
->Event handling
->GUI application
8. EXTENSIONS:
The most important feature of applets on the web, however, is the fact that applets change
the web from being a static medium to one based on interactivity with users. At present,
java is limited only by the capabilities of the internet itself .as the internet grows in data
transmission; java is ready to expand with it.
9. DIAGNOSTICS:
S.NO
1.

Error
Error:Missing semicolon

2.

Exception :Arithmetic Exception

Error:cannot read

4.

Error: Package system doesnot exist

5.

Error:mouseMoved() not present

Debugging
Go to the line number and
place semicolon at the end of
the statement
Dont divide the number
with zero
Make sure that the file is
present in the directory in
which u are executing it
Write the first character of
the System in capital letters
Override the method
67

mouseMethod()

10. QUESTIONS:
1. MOUSE_CLICKED events occurs when________
2. MOUSE_DRAGGED events occurs when ___________
3. __________ events occur when mouse enters a component.
4._________events occur when the mouse exists a component
5. MOUSE_MOVED event occurs when________
6. MOUSE_PRESSED even occurs when __________
7. The ________ events occur when mouse was released.
8. The ___________ event occurs when mouse wheel is moved.
9. An event source is _________
10. A _________ is an object that describes the state change in a source

68

WEEK-10
PROBLEM DEFINITIONS DIFFERENT FROM JNTU TOPICS
S
Proble
Name of the Experiment
Batch- BatchN
m
1
2
o stateme
No
No
nt
No
Write a Java program that handles all mouse events and set the
1
P1
A1
B1
color foreground to pink when a mouse event is fired (Use
Adapter classes).
Write a Java program that handles all mouse events and shows
2
P2
A2
B2
the image at the center of the window when a mouse event is
fired (Use Adapter classes).
Write a Java program to implement mouse event and shows the
3
P3
A3
B3
symbol star when ever user drags the mouse button (Use
Adapter classes).
Write a Java program to implement mouse event and shows the
4
P4
A4
B4
symbol dot when ever user drags the mouse button (Use
Adapter classes).
Write a Java program that handles all mouse events and shows
5
P5
A5
B5
the event name at the center of the window when a mouse event
is fired (without Adapter classes).
Write a Java program that handles all mouse events and set the
6
P6
A6
B6
color foreground to pink when a mouse event is fired (without
Adapter classes).
Write a Java program that handles all mouse events and shows
7
P7
A7
B7
the image at the center of the window when a mouse event is
fired (without Adapter classes).
Write a Java program to implement mouse event and shows the
8
P8
A8
B8
symbol star when ever user drags the mouse button (without
Adapter classes).
Write a Java program to implement mouse event and shows the
9
P9
A9
B9
symbol dot when ever user drags the mouse button (without
Adapter classes).
Write a Java program that handles all mouse events and shows
10
P10
A10
B10
the event name at the center of the window when a mouse event
is fired (without Adapter classes).

69

WEEK-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).
AIM: Write a java program which can read text file into hash table and print the hash
values based on the hash key input.
HARDWARE & SOFTWARE:

Hardware Requirements
Processor
Hard disk Drive
RAM
Keyboard
Monitor
CD ROM
Optical Mouse

Pentium IV
20GB
128MB
111keys Multimedia keyboard
15inches

Software Requirements

Operating System

ZORIN

JAVA

LINUX

2. THEORY:
Text file will contain names and phone numbers which are separated by a tab. This
information has to be recorded in to hash table.

3. ALGORITHMS:
1.create a text file which contains names and phone numbers separated by a tab
2.using buffer reader the file has to be read and the content has to be moved to hash table
using put method.
3. whenever a name is given the corresponding phone number from hash table has to be
displayed

70

4. OBSERVATION:
Input: RAM
Output: 123

5. RESULT:
Displays values from hash table by taking hash key as input

6. INFERENCES:
Hash table is useful in storing key value pairs. It can be populated dynamically

7. APPLICATION:
->Web application
->Data Processing and Analytics

8. EXTENSIONS:
Hash table can also be used to store data retrieved from Databases.

9. DIAGNOSTICS:
S.NO
1.

Error
Error:Missing semicolon

2.

Exception :Arithmetic Exception

Debugging
Go to the line number and
place semicolon at the end
of the statement
Dont divide the number
with zero
71

Error:cannot read

4.

Error: Package system doesnot exist

Make sure that the file is


present in the directory in
which u are executing it
Write the first character of
the System in capital letters

10 .QUESTIONS:
1.___________is a package in which Hashtable class is available
2.split is a method used for _________________
3.capacity of hashtable can be determined by _______________
4._________ method is used to insert record in to hash table
5.________ method is used to know the number of entries in hash table
6.alternative to hashtable is ____________
7._____________ is used to remove all entries of hash table
8. Hash table can be enumerated using ______
9.Scanner class is present in _____________ package
10.Buffered Reader is available in _______ package

WEEK-11
PROBLEM DEFINITIONS DIFFERENT FROM JNTU TOPICS
S
No

Problem
statemen
t
No
P1

P2

P3

Name of the Experiment

Batch1
No

Batch-2
No

Write a Java program that loads rollno and name 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).
Write a Java program that loads student name and branch
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).
Write a Java program that loads college code and college
name 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).

A1

B1

A2

B2

A3

B3

72

P4

P5

P6

P7

P8

P9

10

P10

Write a Java program that loads Employee id and name


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).
Write a Java program that loads Faculty id and name 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).
Write a Java program that loads Class and Strength of class
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).
Write a Java program that loads Bus no. and Starting Point
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).
Write a Java program that loads HTNO and Percentage
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).
Write a Java program that loads name and address 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).
Write a Java program that loads area and phone no. of
police station of that area 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).

A4

B4

A5

B5

A6

B6

A7

B7

A8

B8

A9

B9

A10

B10

73

WEEK-12
Write a Java program that loads names and phone numbers from a database 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).
AIM: Write a java program which can read database into hash table and print the hash
values based on the hash key input.
HARDWARE & SOFTWARE:

Hardware Requirements
Processor
Hard disk Drive
RAM
Keyboard
Monitor
CD ROM
Optical Mouse

Pentium IV
20GB
128MB
111keys Multimedia keyboard
15inches

Software Requirements

Operating System

ZORIN

JAVA

LINUX

2. THEORY:
A database table will contain names and phone numbers. This information has to be
recorded in to hash table.

3. ALGORITHMS:
1.create a table with two columns name and phone numbers. Fill some data.
2.connect to database using jdbc
3.retrieve data and store in to hash table

74

4. OBSERVATION:
Input: rammohan
Output: 987654321

5. RESULT:
Displays values from hash table by taking hash key as input

6. INFERENCES:
Hash table is useful in storing key value pairs. It can be populated dynamically

7. APPLICATION:
->Web application
->Data Processing and Analytics

8. EXTENSIONS:
Hash table can also be used to store data retrieved from Databases.

9. DIAGNOSTICS:
S.NO
1.

Error
Error:Missing semicolon

2.

Exception :Arithmetic Exception

Error:cannot read

Debugging
Go to the line number and
place semicolon at the end
of the statement
Dont divide the number
with zero
Make sure that the file is
75

4.

Error: Package system doesnot exist

present in the directory in


which u are executing it
Write the first character of
the System in capital letters

10 .QUESTIONS:
1.___________is a package in which sql related classes and methods are stored
2.forName is a __________ method
3.Class is a class found in ____________ package
4._________________ is the JDBC URL for oracle
5.________ method is used to execute select statements
6.most preferred jdbc driver is _________________
7._____________ is used to iterate the result set
8. ___________________ is the driver class for oracle
9.Scanner class is present in _____________ package
10._____________ is the port number used by oracle for non http clients

WEEK-12
PROBLEM DEFINITIONS DIFFERENT FROM JNTU TOPICS
S
No

Problem
statemen
t
No
P1

P2

P3

P4

Name of the Experiment

Batch1
No

Batch-2
No

Write a Java program that loads rollno and name from a


database It takes a name or phone number as input and
prints the corresponding other value from the hash table
(hint: use hash tables).
Write a Java program that loads student name and branch
from database It takes a name or phone number as input and
prints the corresponding other value from the hash table
(hint: use hash tables).
Write a Java program that loads college code and college
name from a database It takes a name or phone number as
input and prints the corresponding other value from the hash
table (hint: use hash tables).
Write a Java program that loads Employee id and name
from database It takes a name or phone number as input and
prints the corresponding other value from the hash table
(hint: use hash tables).

A1

B1

A2

B2

A3

B3

A4

B4

76

P5

P6

P7

P8

P9

10

P10

Write a Java program that loads Faculty id and name from a


database . It takes a name or phone number as input and
prints the corresponding other value from the hash table
(hint: use hash tables).
Write a Java program that loads Class and Strength of class
from database. It takes a name or phone number as input
and prints the corresponding other value from the hash table
(hint: use hash tables).
Write a Java program that loads Bus no. and Starting Point
from database It takes a name or phone number as input and
prints the corresponding other value from the hash table
(hint: use hash tables).
Write a Java program that loads HTNO and Percentage
from database It takes a name or phone number as input and
prints the corresponding other value from the hash table
(hint: use hash tables).
Write a Java program that loads name and address from a
database It takes a name or phone number as input and
prints the corresponding other value from the hash table
(hint: use hash tables).
Write a Java program that loads area and phone no. of
police station of that area from a database It takes a name or
phone number as input and prints the corresponding other
value from the hash table (hint: use hash tables).

A5

B5

A6

B6

A7

B7

A8

B8

A9

B9

A10

B10

WEEK-13
77

Write a Java program that takes tab separated data (one record per line) from a text file
and inserts them into a database.
AIM: Write a java program which can read text file and insert the same into database
HARDWARE & SOFTWARE:

Hardware Requirements
Processor
Hard disk Drive
RAM
Keyboard
Monitor
CD ROM
Optical Mouse

Pentium IV
20GB
128MB
111keys Multimedia keyboard
15inches

Software Requirements

Operating System

ZORIN

JAVA

LINUX

2. THEORY:
A text file with two fields will be read and is inserted into a database table.

3. ALGORITHMS:
1. Read text file line by line
2. Connect to database
3. Insert each line (separated with tab) as fields in to database

78

4. OBSERVATION:
Input: rammohan
Output: 987654321

4. RESULT:
All the records form text file are inserted into Database table

6. INFERENCES:
Databases are more effective than files and operating Databases is easy

7. APPLICATION:
->Web application
->Data Processing and Analytics

8. EXTENSIONS:
Database connection can be pooled in real time applications.

9. DIAGNOSTICS:
S.NO
1.

Error
Error:Missing semicolon

2.

Exception :Arithmetic Exception

Error:cannot read

Debugging
Go to the line number and
place semicolon at the end
of the statement
Dont divide the number
with zero
Make sure that the file is
79

4.

Error: Package system doesnot exist

present in the directory in


which u are executing it
Write the first character of
the System in capital letters

10 .QUESTIONS:
1.___________is a super class of all exception classes
2.forName returns _______________
3.newInstance method is in ___________ class
4._________________represents the connection listener in JDBC
5.________ method is used to execute non select statements
6.Driver software is provided by ____________
7.Result set object is used to ____________________
8. ___________________ is the object returned by getConnection method
9.to improve performance of JDBC operations _________ is used
10._____________ is the port number used by oracle for http clients

PROBLEM DEFINITIONS DIFFERENT FROM JNTU TOPICS


S
No

Problem
statemen
t
No
P1

Name of the Experiment

Batch1
No

Batch-2
No

Write a Java program that takes tab separated data (one


record per line) from a text file and inserts them into a
database with two fields

A1

B1

P2

Write a Java program that takes tab separated data (one


record per line) from a text file and inserts them into a
database with three fields

A2

B2

P3

Write a Java program that takes tab separated data (one


record per line) from a text file and inserts them into a
database with three fields name,dept,address

A3

B3

P4

A4

B4

P5

Write a Java program that takes tab separated data (one


record per line) from a text file and inserts them into a
database with two fields name and age
Write a Java program that takes tab separated data (one
record per line) from a text file and inserts them into a
database with three fields rollno,name and dept.

A5

B5

80

P6

Write a Java program that takes tab separated data (one


record per line) from a text file and inserts them into a
database with three fields eno,design,sal

A6

B6

P7

Write a Java program that takes tab separated data (one


record per line) from a text file and inserts them into a
database with two fields

A7

B7

P7

Write a Java program that takes tab separated data (one


record per line) from a text file and inserts them into a
database with two fileds and null values

A8

B8

P7

Write a Java program that takes tab separated data (one


record per line) from a text file and inserts them into a
database with three fields and null value

A9

B9

10

P7

Write a Java program that takes tab separated data (one


record per line) from a text file and inserts them into a
database with two fields and null values

A10

B10

81

WEEK-14
Write a Java program that prints meta data of a given table.
AIM: Write a java program which can read text file and insert the same into database
HARDWARE & SOFTWARE:

Hardware Requirements
Processor
Hard disk Drive
RAM
Keyboard
Monitor
CD ROM
Optical Mouse

Pentium IV
20GB
128MB
111keys Multimedia keyboard
15inches

Software Requirements

Operating System

ZORIN

JAVA

LINUX

2. THEORY:
Meta data is the data about data. Every table will have metadata. To print metadata of any
table ResultSet Metadata object is needed.

3. ALGORITHMS:
1. Connect to Db
2. Create ResultSetMetaData Object
3. Print details of meta data for a table.

82

OUTPUT:

4. OBSERVATION:
Output: prints no. of columns, column types etc about a table.

5. RESULT:
Meta data about a table is displayed

6. INFERENCES:
To know about the table and its properties meta data is useful

7. APPLICATION:
->Web application
->Data Processing and Analytics

8. EXTENSIONS:
Database connection can be pooled in real time applications.

9. DIAGNOSTICS:
S.NO
1.

Error
Error:Missing semicolon

2.

Exception :Arithmetic Exception

Debugging
Go to the line number and
place semicolon at the end
of the statement
Dont divide the number
with zero
83

Error:cannot read

4.

Error: Package system doesnot exist

Make sure that the file is


present in the directory in
which u are executing it
Write the first character of
the System in capital letters

10 .QUESTIONS:
1.___________is a common exception in JDBC
2.ResutlSetMetaData is created using _______________
3.Data about data is called __________
4._________________is used to set the fetch size
5.autocommit should be turned ______
6.When more number of rows are inserted in same table _____________ is used
7.Result set object is used to ____________________
8. ___________________ is the object used for calling stored procedures
9.Types is a class contains ________
10._____________ is the method used to know the datatype of the columns
WEEK-14
PROBLEM DEFINITIONS DIFFERENT FROM JNTU TOPICS
S
No

Problem
statemen
t
No
P1

2
3
4
5
6

P2
P3
P4
P5
P6

P7

P7

P7

10

P7

Name of the Experiment

Batch1
No

Batch-2
No

Write a Java program to print metadata of emp table

A1

B1

Write a Java program to print no. of cols of a table


Write a Java program that prints no. of cols and datatypes
Write a Java Program to print metadata of any table
Write a Java program that prints schema name of a column
Write a Java program to print colum types of all columns in
a table
Write a Java program to retrieve metadata(is currency) of a
column
Write a Java program to check whether a given table is
searchable or not
Write a Java program using switch statement to print
datatypes of all columns in a table
Write a Java Program to print metadata of tab.

A2
A3
A4
A5
A6

B2
B3
B4
B5
B6

A7

B7

A8

B8

A9

B9

A10

B10

84

También podría gustarte