Implementing and Testing the Student Class
January 29th, 2016
Lecture Code
Testing
- Constructing a driver program.
- There should be a method public static void main (String [] args)
- Constructing a unit test with JUnit.
- The main class should extends junit.framework.TestCase
- Use the method assertEquals(argument 1, argument 2, delta);
Course Class
Today we will add capability to the Student program by implementing
a Course class. This is called an association in UML. This is different than
dependencies. Both associations and dependencies are different
forms of relationships between classes. (
if curious about UML and
discussion on difference)
Referencing Objects from within Objects
- slides
- Variables do not contain objects, they contain addresses that
point to objects.
Take-home Exercise