0% found this document useful (0 votes)
25 views3 pages

Sem-4 Java 6 Marks IMPs

Uploaded by

saqibzuber813
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)
25 views3 pages

Sem-4 Java 6 Marks IMPs

Uploaded by

saqibzuber813
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
You are on page 1/ 3

6 MARKS QUESTIONS

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.

11.Compare array and vector. Explain elementAT( ) and addElement( )


methods.
12.Define an exception called ‘No Match Exception’ that is thrown when the
passward accepted is not equal to ‘MSBTE’. Write the program.
13.Write a program to check whether the string provided by the user is
patindrome or not.
14.Define thread priority? Write default priority values and the methods to
set and change them.
15.Design an applet to perform all arithmetic operations and display the
result by using labels. textboxes and buttons.
16.Write a program to copy all elements of one array into another array.
17.Explain thread life cycle with neat diagram.

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:

7. Write a program to implement the following inheritance.


8. Write a program to print even and odd number using two threads with
delay of 1000ms after each number.
9. Write a program to input name and salary of employee and throw user
defined exception if entered salary is negative.
10.Write a program to generate following output using drawline () method.

IMP
V.IMP
V.V.IMP

You might also like