




























































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





























































Important one! Should visit often when coding
there is a JVM compiled for
that particular processor and OS Typical program, like C or C++, iscompiled for a particular processorarchitecture and OS. “Write once, run everywhere!”^ Sun’s motto for Java
Scientific computation, games, OS kernel Compiled to byte codes of JVM, not native machinelanguage instructions New release of Java is improving the speed a lot^ ^ Just-in-time (JIT) compiler: convert byte codes to nativemachine language on the fly ^ Very safe^
No pointer Automatic garbage collection Check array access bound
detailed instructions to help you run your first program http://java.sun.com/docs/books/tutorial/getStarted/cupojava/index.html ^ All text editors support java^
Vi/vim, emacs, notepad, wordpad Just save to .java file ^ Have IDEs that comparable to Visual Studio^
JCreator (simple) Eclipse (more complicated)
The file name
MUST
be the same as class
name Compile with: javac Foo.java Creates compiled .class file: Foo.class Run the program: java Foo^
Notice: use the class name directly, no .class!
: modifier. This class is publicly available and anyone can use it.
case sensitive
whitespace
doesn’t matter for compilation
File name must be the same as one of theclass names,
including capitalization
At most one public class per file If there is one public class in the file, thefilename must be the same as it Generally one class per file