IntroJava

IntroJava - The Compilation Process source file #include...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: The Compilation Process source file #include <stdio.h> main() { printf("hello\n"); } The Java Interpreter source file import acm.program.*; public class Hello public void run() { println("hello"); } } object file 0100100101011001000 1000010100011101011 0110100111010101100 class file CA FE BA BE 00 03 00 00 16 07 00 1A 07 00 00 04 00 07 0C 00 13 01 00 16 2B 4C 6A 61 CA 00 00 01 47 2D 14 00 JAR archive FE 16 04 00 72 00 0A 18 BA 07 00 16 61 1F 00 0C BE 00 07 2B 70 08 02 00 00 1A 0C 4C 68 00 00 17 03 07 00 6A 69 0F 08 00 00 00 13 61 63 07 0A 1C compiler executable file 0100100101011001000 1000010100011101011 0110100111010101100 1001011010110001011 0100100101001011011 0101101011010100101 compiler linker linker other object files and libraries 1001011010110001011 0100100101001011011 0101101011010100101 other class files 47 2D 14 00 72 00 0A 18 61 1F 00 0C 70 08 02 00 68 00 00 17 69 0F 08 00 63 07 0A 1C JVM Hello hello Graphic courtesy of Eric Roberts Graphic courtesy of Eric Roberts acm.program Hierarchy Applet The Add2Integers Program class Add2Integers extends ConsoleProgram { public void run() { println("This program adds two numbers."); int n1 = readInt("Enter n1: "); int n2 = readInt("Enter n2: "); int total = n1 + n2; println("The total is " + total + "."); } } n1 n2 total 17 25 42 Add2Integers JApplet Program ConsoleProgram DialogProgram GraphicsProgram This program adds two numbers. Enter n1: 17 Enter n2: 25 The total is 42. Graphic courtesy of Eric Roberts Graphic courtesy of Eric Roberts 1 ...
View Full Document

This note was uploaded on 10/25/2010 for the course CS 106A taught by Professor Sahami,m during the Fall '08 term at Stanford.

Ask a homework question - tutors are online