[Go to site: main page, start]

0% found this document useful (0 votes)
4 views2 pages

Practical Java

The document outlines a list of programming tasks for a practical file, including string manipulation, class creation, interface implementation, exception handling, file operations, and GUI development. Each task specifies the requirements and expected outcomes, such as creating complex number classes, handling exceptions for employee age, and building interactive applets and frames. The tasks cover a range of programming concepts and techniques suitable for practical application in software development.

Uploaded by

y.shubhamy2014
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views2 pages

Practical Java

The document outlines a list of programming tasks for a practical file, including string manipulation, class creation, interface implementation, exception handling, file operations, and GUI development. Each task specifies the requirements and expected outcomes, such as creating complex number classes, handling exceptions for employee age, and building interactive applets and frames. The tasks cover a range of programming concepts and techniques suitable for practical application in software development.

Uploaded by

y.shubhamy2014
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

PROGRAM LIST FOR PRACTICAL FILE

1. Write a program that takes your full name as input and displays the
abbreviations only. For example, if your name is Ramesh Chandra Sharma,
then the output should be R.C.S.
2. Write a program to check whether a letter 'a' is present in the string, given
through Command Line Argument also count the occurrence of ‘a’ in the
string.
3. Write a program to delete all vowels from the string "Hello, have a good
day".
4. Create a class Complex with two data members “real” and “img”.

i) incr() -- increase value of real and img by 1.


ii) display() - display complex number like as : real= 4, imaginary= 6
iii) setData(int re, int im) - initiate the value of real by re and img by
im.
iv) Add(Complex) - add two objects and return the result.
v) Write all possible constructors.

5. Extend the above class by create new class “AdvanceComplex”. Write a


method “multiply” to multiply two complex values.
6. Write an interface : “Shape”.
interface Shape
{ public final double pi=22.0/7;
public void perimeter();
public double area();
}
Now implement above interface and create Circle class. And find out the
area and perimeter of an object of radius 7.
7. Create a package pkg and Create two class Alpha and Beta class. Write a
display function in both the classes which print the class name. Now create
a new class Gamma, outside the package and execute display methods of
Alpha class as well as Beta class.
8. Write a main function to divide two numbers. Handle the exception if
denominator is zero using Exception handling.
9. Write a class Employee. Take String name and int age as two members of
this class. If age is above 60, exception occurs. (“Hint : create your own
exception class”).
10. Write a program to read a text file (character by character) and print on the
screen.
11. Write a program, which write a string (take input through keyboard) into a
file.
12. Prepare an applet with a button on it. Apply listener on the button.
13. Prepare an awt frame with a button on it. Apply listener on the button.
14. Create a frame with three buttons named as “Green”, “Red”, “Blue”. If
button “Green” is pressed, “Hello Green” appears on command line
similarly, if “red” button is pressed then “Hello Red” appears on command
line and so on. Also take one more button to exit.
15. Create a frame. Take TextField, Label. When you write on TextField
characters also appears on Label also. If we write “Exit” in TextField
program terminates.
16. Write a program to demonstrate event handling with mouse.
17. Write a program to demonstrate event handling with keyboard.
18. Write a program to prepare Notepad Like application with Menu Bar.

You might also like