Skip to content

Lecture 2

attendance_quiz WILL BE ISSUED (Last time there will be a warning for these)!
Quiz Area

Before We Start:

Setup your Computer

From the previous Lecture:

The rules of CS1111

  1. The first rule of CS1111 is RTFI
  2. The second rule of CS1111 is RTFI
  3. Start early
  4. FTFI: Follow The Fantastic Instructions
  5. Plan before coding
  6. Debug smart
  7. Prepare your questions
  8. Ask for help

Programming in a nutshell

  • Programming language → execution
  • Code – human readable (Java)
  • Executable – machine “readable”
  • Compiler – converts from code → executable. It's like Google translate for computers
  • What happens when you type in nonsense?
    beatbox
    (Must speak the language you're translating from)
  • Syntax errors – not speaking “java” correctly

Compilation

The source file:

  • home/pfrank/cs111/module01/
    • exampleFile.java

Request that the compiler "compile the" source file into an executable:

javac exampleFile.java

You should have:

  • home/pfrank/cs111/module01/
    • exampleFile.java
    • exampleFile.class

Request that the java runtime "execute the" executable file:

java exampleFile

Where is this request done? Either from the terminal or from an IDE (JGrasp in our case).

Test your system:

Write a Hello World program in JGrasp. First, make sure you place it in a directory that will hold your class work like:

  public class HelloWorld 
  {
    public static void main (String[] argv)
    {
      System.out.println("Hello World!");
    }
  }
  
  • /Users/pablo/cs1111/module01/HellowWorld.java ...or
  • C:\Documents and Settings\All Users\pablo\cs1111\module01\HellowWorld.java
    • This is how it should look in JGrasp:

      Compile

      Press the green PLUS button

      Execute

      Press the red RUNNER button

      Finally, Set the number of spaces per tab to 2 (preferred) or 4

previous lecture | next lecture