Skip to content

Latest commit

 

History

History
33 lines (20 loc) · 2.08 KB

File metadata and controls

33 lines (20 loc) · 2.08 KB

General Java, Object-Oriented, and General Programming Links

Commonly used classes

I don't expect you to memorize all the methods from these packages but you will be using them extensively this semester so you should be able to use the documentation to find any methods you will need.

compareTo

When you have a line in your code like the following:

return (name.compareTo(m.getName()));

Note that this is not a recursive call to compareTo - it is calling the compareTo() of the String class (or whatever the type is for data member m). This is common way of implementing a compareTo method since it leverages code that has already been implemented for the data member. If we want to sort our class based on a String data member then using the String.compareTo() method is much easier than trying to write something ourselves.

Java Versions

General Programming Advice

  • Why you should always use braces even around one line of code - Apple's SSL Bug Explained
  • Rob Pike's 5 Rules of Programming. Rules 3 - 5 are relevant for CSC205. We will learn a lot of different algorithms and data structures, but keep in mind that it isn't always worth it to use the more advanced ones. You have to decide based on the specific problem you are trying to solve.

Interesting Code

Lines of Code That Changed Everything has some examples of famous (or infamous) programs