CIS525 - Lecture#9 - October 4, 2000
CIS 525 10/4/00
Chap 6:
Java is downloaded onto a local hardrive, where it runs its applications
For this reason, yhou can run simple animation and games on the web
Java:
=> derived from C++, syntax and declarations similar to C++
=> class library/hierarchy, (similar to SmallTalk)
=> code is compiled into a language independent intermediate form
=> Sun maintains 'official' standard, still has lots of fragmentation,(Micorsoft J++, etc)
myths about Java:
* is only for web applications
* is totally transparent across platforms
* is simple, (I/O can be difficult to use)
Tools for Java:
1) some text-based editor
2) Java compiler, (found in 'jdk')
javac.exe is compiler
.java, (use this extension when saving file from text editor)
javac.exe will convert the text file, (.java), to a .class extension
3a) Java interpreter, (for stand-alone operation)
javac.exe actually RUNS the application of .class
OR
3b) Java enabled browser, or a utility called 'appletviewer.exe'
4) Java byte code verifier, (embedded in interpreter)
Be sure to set path to avoid having to enter it in its entirety:
example:
path=C:\windows;C:\windows\command;c:\;c:\dos;c:\jdk1.1.4\bin
See page 243 of Hall for a Hello World applet display in browser
HelloWWW.html
note: the dos command to view any source code is, for example
c:\Java\Chapter6> type "_______"
OR
c:\Java\Chapter6> edit "_______"
Chapter 7
Object Oriented Programming in Java
Instance Variable declaration, example;
point P1 = new Point(2,11);
scrollbar bar = new Scrollbar(); <= a constructor
point P1 = window.location();
string String1 = new String("A String");
* This can be shortened to:
string String2 = "Another String";
For ANY stand alone application, you must have;
void main()(;
Java conventions for naming:
1) use lower case for first letter of instance variable name, (firstName)
2) begin class names with uppercase
3) constants in all uppercase