Get your essays here, 33,000 to choose from!

Limited Time Offer at Free College Essays!!!

Java Class Design

11 Pages 2642 Words


own as the driver method for the program. If every program did not contain a main method, the application would not know when to start or end execution. When methods are declared in Java, they must be declared with an access modifier, which is a keyword in Java that sets the scope of a variable or a method. This access modifier will tell what other methods or classes can access the method or variable outside of the class in which it is declared. A method must also have a return type. The return type will be a primitive data type, such as int, double, or float and the return type must be consistent with the type of data that is returned at the end of the method. Methods are used to do services for the class, such as calculating the area or calculating the paycheck for an employee. A method cannot exist outside of a class, and a class would have no purpose without the internal methods.
1.2 Designing a Class
Class design is a very important concept in Java. Without a well designed class, object oriented programming is not needed. As has already been stated, classes are just a blue print for the rest of the program. The class should hold the methods that the program will implement. There are two concepts in class design, which will be discussed in more detail later in this paper. One of the two types of the class design concepts is the concept of many small classes, and the other is the concept of large classes that will contain many more methods and will implement many more concepts.
1.3 Creating a New Class and Class Type
When creating a new class type, the first thing that must be decided is what type of class is going to be declared. In most cases, classes will be declared public, but there are instances in which a class would need to be declared static, for example, if the class is a nested class, the class that is nested will have to be declared as static. Besides deciding what type of class to implement, the program...

< Prev Page 2 of 11 Next >

Essays related to Java Class Design

Loading...