Wednesday, September 28, 2011

Scripting Language Versus Compiled Language

After reviewing some of the basic slides that John Zelle put up about Teaching Computer Science with Python, my student asked me what a scripting language was.  I compared Python to C and then threw in Java, a byte compiled language, to round out the comparison.

Program in C.

/* Hello World program */
#include<stdio.h>
main()

{   

printf("Hello World");


}

 Since we're on a Mac, the command in the terminal is:

gcc -o helloworld helloworld.c

Program in Java

class HelloWorldApp{     
public static void main(String[] args) {         
System.out.println("Hello World!"); // Display the string.    

}

}
byte compile the Java code:
javac HelloWorldApp.java

Run it:
java HelloWorldApp
Python

print ("Hello World")




No comments:

Post a Comment