Upload
cecilia-marsh
View
223
Download
2
Embed Size (px)
Citation preview
Overview of Java
CSCI 392
Day One
Running C code vs Java code
C Source Code
C Compiler
Object File(machine code)
LibraryFiles
Linker
Executable File(machine code)
Java Source Code
Java Compiler
Java Byte Code
Java Platform(API)
Java Virtual Machine(interpreter / JIT compiler)
portable between machine types
Java Design Features
Byte Code is machine independent
Network-Centric provides OS-type services security is a fundamental concern
Java 5.0 includes 3562 classes in 166 packages, including support for client-server operation concurrency parsing web data etc
Hello World 1.0
class hello{ static void main (String[] args) { System.out.println("Hello World"); }}
$ vi hello.java$ javac hello.java$ lshello.class hello.java$ java helloHello World
Hello World 1.1
public class hello2{ public static void main (String[] args) { int num_loops; // numbers of hellos to print
// test the user input if (args.length != 2) { System.out.println("Usage Error: java hello2 name count"); return; }
// convert the command line arg from string to int num_loops = Integer.parseInt (args[1]);
// print the hellos for (int i=0; i<num_loops; i++) System.out.println("Hello " + args[0]); }}