Transition from Turing to Java


 

Basic Output:
put "Hello World!"
System.out.println("Hello World");

Program Framework:

  • Turing has no program framework. You type your commands in the Turing editor and Run the program.
  • Java programs are complicated by the fact that they could potentially run on many systems with many types of hardware. While the framework can be confusing, it is necessary so that Java can be as versatile and powerful as it is.
    • The Java framework is marked in blue bold.
    • The parts you should change as a new Java programmer are marked in red bold.
    • See this note on your First Java Program.
put "Hello World!"

class HelloWorld

{

   public static void main (String[] args)

   {

      System.out.println("Hello World");

   }

}

Variables & Assignment Operator:  

var age : int

var bankBalance : real

var name : string

 

age := 16

bankBalance := 103.24

name := "Fred Flintstone"

int age;

double bankBalance;

String name;

 

age = 16

bankBalance = 103.24

name = "Fred Flintstone"