2014-09-15 Notes

posted Sep 15, 2014, 7:44 AM by Samuel Konstantinovich   [ updated Sep 15, 2014, 11:02 AM ]
lisa.stuy.edu 149.89.160.100
homer.stuy.edu 149.89.150.100
bart.stuy.edu 149.89.151.100
marge.stuy.edu 149.89.161.100

307: 150.xxx  cslab1-1 ... cslab1-30  where xxx is 101-130
325: 151.xxx  cslab2-1 ... cslab2-30  where xxx is 101-130
251: 160.xxx  cslab3-1 ... cslab3-31  where xxx is 101-131
451: 161.xxx  cslab4-1 ... cslab4-32  where xxx is 101-132

SSH to any host with a final number 101-105 using its ip address
*nix command: ssh user@host
Win: puTTY

File transfer (also to hosts from 101-105) uses SFTP: Filezilla  (port 22)

Resources:
Very Basic Linux Tutorial for n00bs and forgetful people:  https://www.digitalocean.com/community/articles/an-introduction-to-linux-basics

More detailed Linux/Unix tutorial:

Java code for reference:

EXAMPLE 1:
file: helloworld.java
public class helloworld{
    public static void main(String[]args){
        System.out.println("Hello world");
    }
}

EXAMPLE 2 (2 files)
file: Demo.java
public class Demo{
    public static void main(String[]args){
        something X,bob;
    
        //create 2 instances of the something class (instantiate)
        X=new something();
        bob=new something();

        //manually set the variables inside of the X object:
        X.a=3;
        X.b=-2;

        //call the method 'print' from in the something class
        X.print();
        bob.print();
    
    }
}

file: something.java
public class something{
    int a,b;
    public something(){
    }

    public void print(){
        System.out.println(a+","+b);
    }
}

Example 3: (greeter class)
public class demo{
    public static void main(String[]args){
greeter bob,amy;
bob = new greeter();
amy = new greeter("Hola");
bob.greet();
amy.greet();
    }
}

public class greeter{
    //instance variables - the information each object can remember
    String greeting;

    //constructor - the method that is called to instantiate an object
    public greeter(){
greeting = "Hello!!!";
    }

    public greeter(String s){
greeting = s;
    }

    //other methods
    public void greet(){
System.out.println(greeting);
    }
}

Comments