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

Java Lab Questions

The document outlines various programming tasks, including conditional statements, exception handling, function overloading, and object-oriented programming concepts. It includes creating classes, methods for mathematical operations, handling user input, and implementing GUI elements. Additionally, it covers topics like factorial calculation, prime number checking, and mouse event handling.

Uploaded by

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

Java Lab Questions

The document outlines various programming tasks, including conditional statements, exception handling, function overloading, and object-oriented programming concepts. It includes creating classes, methods for mathematical operations, handling user input, and implementing GUI elements. Additionally, it covers topics like factorial calculation, prime number checking, and mouse event handling.

Uploaded by

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

1. Program to assign two integer values to X and Y.

Using the ‘if’ statement the


output of the program should display a message whether X is greater than
Y.

2. Create a package ‘student. Fulltime BCA’ in your current working directory.


a. Create a default class student in the above package with the following
attributes: Name, age, sex. b. Have methods for storing as well as displaying.

1. Program to list the factorial of the numbers 1 to 10. To calculate the factorial
value, use while loop. (Hint Fact of 4 =4*3*2*1)

2. Program to catch Negative Array Size Exception. This exception is caused


when the array is initialized to negative values.

1. Program to add two integers and two float numbers. When no arguments are
supplied, give a default value to calculate the sum. Use function overloading.

2. Program to handle Null Pointer Exception and use the “finally” method to
display a message to the user.

1. Program to perform mathematical operations. Create a class called AddSub


with methods to add and subtract. Create another class called MulDiv that
extends from AddSub class to use the member data of the super class.
MulDiv should have methods to multiply and divide A main function should
access the methods and perform the mathematical operations.

2. Program which creates a frame with two buttons father and mother. When
we click the father button the name of the father, his age and designation
must appear. when we click mother similar details of mother also appear.
1. Program with class variable that is available for all instances of a class. Use
static variable declaration. Observe the changes that occur in the object’s
member variable values.

2. Program which create and display a message on the window.

1. Program to accept a number and find whether the number is Prime or not.

2. Demonstrate the various mouse handling events using suitable example.

1. In a college first year class are having the following attributes name of the
class(BCA, [Link], BSC), name of the staff number of students in the class,
array of student in the class.

2. Program to create menu bar and pull-down menus.

You might also like