In Class: Week 1, Thursday


In your cs21 subdirectory create a directory named week1, and cd into that directory:
% cd            # make sure you are in your home directory
% ls		# list the contents of your home directory
   cs21/	# should be a single directory that we created last time
% cd cs21       # change directories to cs21
% pwd		# check that you are in your /home/username/cs21 sub directory

% mkdir week1   # make a new directory named week1 in your cs21 directory 	
% cd week1
% pwd		# check that you are in your /home/username/cs21/week1 sub directory

Now copy over all the files from my public/cs21/week1 directory into your week1 directory (remember to add the dot as the destination of the cp command):

% cp ~newhall/public/cs21/week1/* .
% ls
  1. We are going to start by looking at the MyFirstClass.java program together, so go ahead and open it in vim, or emacs:
    % vim MyFirstClass.java  
    
    To compile and run the MyFirstClass program:
    % javac MyFirstClass.java              # compile Java source code to bytecode 
                                            # creates MyFirstClass.class file 
    % ls
      MyFirstClass.class  MyFirstClass.java 
    % java MyFirstClass	                 # run the class on the java virtual machine 
    

  2. Try modifying the .java file to print out a different string, recompile it, and run it.

  3. Next, lets look at the InputExample.java file.