Sem-4 Java 6 Marks IMPs
Sem-4 Java 6 Marks IMPs
1. Describe the use of any methods of vector class with their syntax.
2. Explain the concept of Dynamic method dispatch with suitable example.
3. Explain the command line arguments with suitable example.
4. Describe the applet life cycle in detail.
5. How to create user defined package in Java. Explain with an suitable
example.
6. Explain how to pass parameter to an applet? Write an applet to accept
username in the form of parameter and print “Hello”.
7. Write a program to perform following task
(i) Create a text file and store data in it.
(ii) Count number of lines and words in that file.
8. What is constructor? List types of constructors. Explain parameterized
constructor with suitable example.
9. Explain any four methods of string class.
10.Write a Java applet to draw a bar chart for the following values.
IMP
V.IMP
V.V.IMP
PROGRAMS:
1. Write a program to create two threads. One thread will display the
numbers from 1 to 50 (ascending order) and other thread will display
numbers from 50 to 1 (descending order).
2. Write a program to create a vector with five elements as (5, 15, 25, 35,
45). Insert new element at 2nd position. Remove 1st and 4th element
from vector.
3. Write a program to create two threads one thread will print even no.
between 1 to 50 and other will print odd number between 1 to 50.
4. Write a program to create a class ‘salary’ with data members ‘empid’,
‘name’ and ‘basicsalary’. Write an interface ‘Allowance’ which stores
rates of calculation for da as 90% of basic salary, hra as 10% of basic
salary and pf as 8.33% of basic salary. Include a method to calculate net
salary and display it.
5. Write a Java program in which thread A will display the even numbers
between 1 to 50 and thread B will display the odd numbers between 1 to
50. After 3 iterations thread A should go to sleep for 500 ms.
6. Implement the following inheritance:
IMP
V.IMP
V.V.IMP