Thursday, March 24, 2011

Comparing two Strings

Today, we continued to work on our Course and CourseSection class in our teams. Seems like there are a few overlapping elements but I clarified them with Mr.Arkin. I also found out that you can create arrays with other data types than the general String, int, double, etc. When comparing two strings, you cannot use an if statement with a direct equals operator and check if it equals a String. This is because Strings are objects, therefore, we need to use a string method such as the equals method, or the compareTo method. This advice helped when we were comparing our course elements in the array. We are continuing to refine the code so the code cannot be broken.

No comments:

Post a Comment