In this reading we’ll round out our knowledge of class design by learning about main
methods and how to write them and learning how to create documentation using Javadoc comments. You’ll also see the design of another class, ClassPeriod
, that makes use of another class that was already explored, the Student
class.
Sections 11.6-11.8 (pp. 366-373) from the course textbook.
Each student will be responsible for learning and demonstrating proficiency in the following objectives PRIOR to the class meeting. The reading quiz will test these objectives.
main
method.main
method (e.g. visibility, return type, …).The following objectives should be mastered by each student DURING and FOLLOWING the class session through active work and practice.
main
method to create objects of that class and invoke methods on them.These exercises are geared towards mastering the BASIC learning objectives listed above. You are expected to submit them before class and it is highly recommended that you complete them before attempting the reading quiz.
Write a Java class named HelloWorld
. This class contains only one thing: a main
method that prints out the string “Hello World.”
Write a Java class named StudentClub
. This class should contain 3 fields: the name of the club (a String), the members of the club (an array of Student
objects), and the president of the club (a single Student
object) This class should also contain a method named printMembers
which should print out the name of every member in the club. You may assume that the Student class has a method named getName
that can be used to retrieve the name of the student.
Your code should contain Javadoc comments for the class and method.