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

Java Lab EPractice - Classes and Objects

This document contains instructions for 4 Java programming questions that involve classes and objects. Q1 asks to create a 4 element int array, calculate the average, and display it. Q2 asks to create a 2D array with specified int values. Q3 asks to create a Person class with name, age, salary instance variables, create an object, and set/display using methods. Q4 asks to create a Person class using default and parameterized constructors, and set/display instance variables using the constructors.

Uploaded by

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

Java Lab EPractice - Classes and Objects

This document contains instructions for 4 Java programming questions that involve classes and objects. Q1 asks to create a 4 element int array, calculate the average, and display it. Q2 asks to create a 2D array with specified int values. Q3 asks to create a Person class with name, age, salary instance variables, create an object, and set/display using methods. Q4 asks to create a Person class using default and parameterized constructors, and set/display instance variables using the constructors.

Uploaded by

Tanuja Das
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Java Lab Practice 1 – Classes and

Objects
Q1. Write a program that creates and initializes a four-
element int array. Calculate and display the average of its
values.

Q2. Write a program that creates a 2-d array with int values.
The first element should be an array containing 30. The
second array should be an array containing 300 and 500.
The third element should be an array containing 3000, 5000
and 5000.

Q3. WAP that describes a class person. It should have instance


variables to record name, age and salary. Create a person
object. Set and display its instance variables using methods.

Q4. WAP that describes a class person using default and


parameterized constructors. It should have instance
variables to record name, age and salary. Set and display
the instance variables using the constructors.

You might also like