import java.util.Scanner;
// https://docs.oracle.com/javase/8/docs/api/java/util/Scanner.html
// look up String, BigDecimal

public class Wednesday {
  public static void main(String[] args) {
    Scanner zeus; 
    zeus = new Scanner(System.in); // scanner reads from the keyboard
    // System.out.println( zeus );     
    System.out.print("What's your name: "); 
    String name = zeus.nextLine();
    // https://docs.oracle.com/javase/8/docs/api/java/util/Scanner.html#nextLine--
    System.out.print("Hi, " + name + ", how old are you: "); 
    String answer = zeus.nextLine();
    System.out.println( "Well, " + name + " you will be " + (answer + 1) + " next year." );
  }
}

A bit later on silo:

-bash-4.2$ pwd
/u/dgerman/c212-summer2018-workspace/lab03
-bash-4.2$ ls -l
total 0
-bash-4.2$ nano -w Wednesday.java
-bash-4.2$ ls -l
total 4
-rw-r--r-- 1 dgerman faculty 719 Jun 20 14:57 Wednesday.java
-bash-4.2$ clear
-bash-4.2$ pwd
/u/dgerman/c212-summer2018-workspace/lab03
-bash-4.2$ ls -l
total 4
-rw-r--r-- 1 dgerman faculty 719 Jun 20 14:57 Wednesday.java
-bash-4.2$ cat Wednesday.java
import java.util.Scanner;
// https://docs.oracle.com/javase/8/docs/api/java/util/Scanner.html
// look up String, BigDecimal

public class Wednesday {
  public static void main(String[] args) {
    Scanner zeus;
    zeus = new Scanner(System.in); // scanner reads from the keyboard
    // System.out.println( zeus );
    System.out.print("What's your name: ");
    String name = zeus.nextLine();
    // https://docs.oracle.com/javase/8/docs/api/java/util/Scanner.html#nextLine--
    System.out.print("Hi, " + name + ", how old are you: ");
    String answer = zeus.nextLine();
    int age = Integer.parseInt(answer);
    System.out.println( "Well, " + name + " you will be " + (age + 1) + " next year." );
  }
}
-bash-4.2$ javac Wednesday.java
Picked up _JAVA_OPTIONS: -Xms512m -Xmx512m
-bash-4.2$ java Wednesday
Picked up _JAVA_OPTIONS: -Xms512m -Xmx512m
What's your name: Laura
Hi, Laura, how old are you: 2
Well, Laura you will be 3 next year.
-bash-4.2$

Next we discuss Penguin.java and Tuesday.java in Lab Assignment 03:

-bash-4.2$ pwd
/u/dgerman/c212-summer2018-workspace/lab03
-bash-4.2$ ls
Wednesday.class  Wednesday.java
-bash-4.2$ nano -w Penguin.java
-bash-4.2$ ls -l
total 12
-rw-r--r-- 1 dgerman faculty 2398 Jun 20 15:05 Penguin.java
-rw-r--r-- 1 dgerman faculty 1028 Jun 20 14:57 Wednesday.class
-rw-r--r-- 1 dgerman faculty  719 Jun 20 14:57 Wednesday.java
-bash-4.2$ javac Penguin.java
Picked up _JAVA_OPTIONS: -Xms512m -Xmx512m
-bash-4.2$ ls -l
total 16
-rw-r--r-- 1 dgerman faculty 1499 Jun 20 15:05 Penguin.class
-rw-r--r-- 1 dgerman faculty 2398 Jun 20 15:05 Penguin.java
-rw-r--r-- 1 dgerman faculty 1028 Jun 20 14:57 Wednesday.class
-rw-r--r-- 1 dgerman faculty  719 Jun 20 14:57 Wednesday.java
-bash-4.2$ java Penguin
Picked up _JAVA_OPTIONS: -Xms512m -Xmx512m
Exception in thread "main" java.awt.HeadlessException:
No X11 DISPLAY variable was set, but this program performed an operation which requires it.
        at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:204)
        at java.awt.Window.<init>(Window.java:536)
        at java.awt.Frame.<init>(Frame.java:420)
        at java.awt.Frame.<init>(Frame.java:385)
        at javax.swing.JFrame.<init>(JFrame.java:189)
        at Penguin.main(Penguin.java:47)
-bash-4.2$

On silo through a normal connection we can't run the program. 

In DrJava it works fine. 

If we establish a PuTTY SSH connection with X11 forwarding and start Xming:

-bash-4.2$ pwd
/u/dgerman/c212-summer2018-workspace/lab03
-bash-4.2$ ls -l
total 16
-rw-r--r-- 1 dgerman faculty 1499 Jun 20 15:05 Penguin.class
-rw-r--r-- 1 dgerman faculty 2398 Jun 20 15:05 Penguin.java
-rw-r--r-- 1 dgerman faculty 1028 Jun 20 14:57 Wednesday.class
-rw-r--r-- 1 dgerman faculty  719 Jun 20 14:57 Wednesday.java
-bash-4.2$ xeyes
-bash-4.2$ xclock
Warning: Missing charsets in String to FontSet conversion
-bash-4.2$ java Penguin
Picked up _JAVA_OPTIONS: -Xms512m -Xmx512m
^C-bash-4.2$ cat Penguin.java
import javax.swing.JComponent;
import java.awt.Graphics;
import java.awt.Color;
import java.awt.Polygon;

import javax.swing.JFrame; // from Tuesday

public class Penguin extends JComponent {
  int width, height;
  public Penguin(int width, int height) {
    this.width = width;
    this.height = height;
  }
  public void paintComponent(Graphics g) {
    // default color is Color.BLACK
    g.drawOval(  0,   0, 500, 500); // circle in the background (not necessary) [ 0]
    g.setColor(Color.WHITE);
    g.fillRect(  0,   0, 500, 500); // background (see marks by circle)         [ 0]
    g.setColor(Color.BLACK);
    g.fillPolygon( new Polygon // put this last                                 [11]
                    ( new int[] {  10, 265, 499 },
                      new int[] { 274,  60, 274 },
                      3
                    )
                 );
    int left = 5;
    g.fillOval( 80-left,  50, 365, 400); // body                                [ 1]
    g.setColor(new Color(220, 220, 220));
    g.fillOval(120-left, 190, 290, 250); // larger belly                        [ 2]
    g.setColor(Color.WHITE);
    g.fillOval(155-left, 195, 220, 240); // smaller belly                       [ 3]
    g.setColor(new Color(240, 200, 40)); // some gold
    g.fillOval( 85-left, 390, 175,  80); // right foot (left)                   [ 4]
    g.setColor(new Color(240, 200, 40));
    g.fillOval(285-left, 390, 175,  80); // left foot (right)                   [ 5]
    g.setColor(new Color(255, 255, 255));
    g.fillOval(170-left,  74,  92, 117); // right eye (left)                    [ 6]
    g.setColor(new Color(255, 255, 255));
    g.fillOval(264-left,  94, 107,  79); // left eye (right)                    [ 7]
    g.setColor(Color.BLACK);
    g.fillOval(230-left, 120,  25,  33); // right eye pupil (left)              [ 8]
    g.fillOval(270-left, 124,  17,  23); // left eye pupil (right)              [ 9]
    g.setColor(new Color(240, 200, 40)); // gold as feet
    g.fillArc (188-left, 173, 150, 150, 55,  65); // bill, beak                 [10]
  }
  public static void main(String[] args) {
    JFrame a = new JFrame();
    int width = 500, height = 500;
    a.setVisible(true);
    a.setSize(width+20, height+40);
    // how can you determine 20, 40 dynamically?
    Penguin b = new Penguin(width, height);
    a.add(b);
  }
}
-bash-4.2$

You see how I made the class self-contained (main, one extra import statement). 

Present: Ryan Jiaxing Mary-Ann Serena Henri Bakr Rui Matthew Jay 
Zejun Jingyun Yiwei Andrew Kevin Santiago Adrian Yawen and Runxia 

Absent: Chris