Java Notes
It took a lot longer than expected, but I\'ve finally found a need to learn some Java. My main reference will be this tutorial: http://java.sun.com/PrintPage.jsp?url=http%3A//developer.java.sun.com/developer/onlineTraining/JavaIntro/contents.html.
Update: I\'m at Java again, October, 2003. Expect this page to get a lot more text later. More dramatic discoveries will, as always, receive their own Scribbles.
My Notes:
- possible to have multiple methods of same name - overload. must have different parameters.
- return type \'void\' indicates no value returned to calling component.
- .java - source. .class - compiled.
- method named main is the start.
- java very case sensitive.
- applets have no main. Other program (i.e. browser) handle those tasks.
- /** */ -denotes text for javadoc. Note two *\'s.
- must (should?) define data first, e.g. int x;
- runtime.exec() has something to do with running shell commands. Some good notes at:
http://mountainstorm.com/publications/javazine.html
- URL url = new URL(getCodeBase(), \"myTextFile.txt\");
InputStream is = url.openStream();
- Hashtables are just (?) arrays referenced by a key, like \"alpha\", \"beta\".. rather than index values.
- Example: Class object to print the class name of an object:
void printClassName(Object obj) {
System.out.println(\"The class of \" + obj +
\" is \" + obj.getClass().getName());}