You are on page 1of 2

Read Me:-

i. Before going through below exercises please visit the link given below,
where you can experience the coding standard that each and every
developer should follow.
ii. This Code Conventions for the Java Programming Language document
contains the standard conventions that Sun follow and recommend that
we should follow. It covers filenames, file organization, indentation,
comments, declarations, statements, white space, naming conventions,
programming practices and includes a code example.
iii. You also can find a .pdf doc on the Code Conventions in server i.e. in
/server/javautilities/ codeconventions.pdf.
Duretion : 2hrs

OOPS LAB EXERCISE DAY-1

1. Create a class “ReemapParty” .Inside main method prints some party message with a field
enter fees. Print the party entry fees.
2. Create a class ReemapParty having :
a. Fields Batch Name, total Trainees, Batch Technology, current status of batch.
b. Assign them values while creating them.
c. Create main method and print values of all the above fields.
d. Then try the same example by using method to set the values and to get the values.
3. In the above example don’t assign any values to the field and print the values in the main
method. What values you will get?
4. Create a class NacreTrainee having following fields:
a. Trainee name
b. Batch name
c. Technology
d. Qualification
i. Now in the main method of NacreTrainee create 3 object of above class where trainee
name is compulsory to provide at the time of object creation. Others field you can set
latter on, for which you can use setter method. After object creation and setting the
values display all three object details with the help of getter methods.

ii. Make the class pubic, protected, default and private and observe the output.

iii. Make the fields also private and observe the output.

5. Create a class for Hockey Player with field like:


a. Country Name
b. Player Name
c. Game Name
i) Now create 3 different players with the above attributes, here game name is
common for all i.e hockey. Now print the country name, player name and game
name of each player. Observe the o/p.
6. Create the below 3 class in a source file named as Sport:
a) Create two non-public class Hockey and class Football, with one method which will print
the name of the game i.e getSportName().
b) Create one more class SportTest. Inside the main method of this class create the object
of Hockey and Football and print the name of respective game with the help of method.
c) Now compile this file? What name you will use to compile this file? How many .class file
will be created?
d) Which class name you will use to run the above program?
e) Try to make both the classes public and then compile the source file and see the output.

You might also like