Practical 01
Practical 01
3) Open a notepad window, create a class named Student, and save the file as a java file as
Student.java in your folder.
4) Add an instance variable called name of type string to the Student class.
5) Add a class variable called motto of type string to the Student class.
6) Add an instance method called printMyName() to the Student class. This method must print
the value of the variable name in the Student class.
7) Add a class method called printStudentMotto() to the Student class. This method must print
the value of the variable motto in the Student class.
8) Open a notepad window, create a class named Test, and create the main method inside the
class. Save the file as a java file as Test.java in your folder.
9) Create a student object inside the main method of the Test class. Compile and run the Test
class.
10) Assign “Kamal” to the name variable of the student object you created in the main method of
the Test class.
11) Assign “Wise & Disciplined” to the motto variable of the Student class from within the main
method of the Test class.
12) Print the name variable of the student object in the main method of the Test class.
13) Print the motto variable of the student object in the main method of the Test class.