As I review, I would like to put some notes here as a reference, and a reminder that
I am, actually and necessarily making progress everyday.
- If a STRING is not true, then it must be false.
toStringmethod (function, in fact)
breakis very important in
switchstatement. If you don’t add it at the end
of each case, it will keep running until the end of
- The efficiency of loop does not matter so much with the format (for, foreach
while and do/while). But it does matter if your compiler is not efficient.
- In JAVA, STRINGS are immutable. Aka, when you pass a string, you are just copying
its value to a new place, you CAN NOT change the ORIGINAL value.
- A copy of the entire string is created when passed to a function.
- Some methods of
Stringare very useful. And the more you put them into practice,
the better you can remember them. Practice makes perfect.
- Some useful Classes when deal with date values:
- Compile-time and run-time errors. Q: What are the differences between them?
- ArrayIndexOutOfBoundsException. (Very typical, do you know why?)
try...catch...finally...It is often used in Java, most of the time
because you are not sure what will happen in the run time.
- Two dimension string.
- Resizable arrays with
- You can manage unordered data with
HashMap. It’s a CLASS.
- Data in Hash Map is not in a particular order. So the only way is to use your key.
- Loop through collections using
- Encapsulation: Packing of complex functionality to make it easy to use in an application.
- Refactor is really important in all kinds of programming.
- Organizing classes with packages.
settermethods in class fields definition.
- Abstraction is essential for a good program. One “good” example is the Macro or
DEFINEkeyword in C and C++. In this lecture one example is,
public static long final BLACK = 0x00000000.
- Inheritence and Polymorphism are the TWO major features of Object-Oriented Programming.
- Inheritence: Parent/Child, Base/Derived, Superclass/Subclass. (they have the same meaning!)
extendsis used to create a subclass from superclass.
- The details are hidden within the implementation.
thiskeyword is very useful when you want to change something with super or subclass.
- As an extremely common feature of Object-Oriented Programming, you can easily OVERRIDE
the functions (they call methods) from subclass to superclass.
- Casting. One example:
Kalamata olive1 = (Kalamata)olives.get(0). Force the new object olive1 to be
Kalamata type. (Read more: why Typed Racket is necessary.)
- Interface. More of less like superclass and subclass relationship. But it’s mostly for functions, I guess.
Yeah, it deals with ABSTRACTION. They give you the rough idea of what you should do, then you use
the superclass to fulfill the final functions.
- Abstract class and methods.
abstractensures that functions of superclass are implemented. “This method must be implemented!!!”.
- When dealing with files, beware to handle the exceptions.
FileUtilsfrom Apache Commons is helpful.
- Parsing an XML file. Using Java Core library, or you can choose to use those
- A JAR file is just a ZIP file. It is used to package your file for deployment.
This part of review is almost finished. Now let’s get down to How to Design Programs, and more
importantly, The Structure and Interpretation of Computer Programs, aka, SICP. This course is
still being taught in MIT, for first year CS students.