Search Contact information
University of Cambridge Home Department of Engineering
University of Cambridge >  Engineering Department >  computing help

Java Course and course 3F6

This page covers issues related to CUED's 3F6 course (for those taking course 3F6). Other pages of CUED java support include

CUED's 3F6 Computing course

Many of the topics in the IIA computing paper are helpful when learning Java. Also, Java might be an easier language than C++ for learning about them. Here are some useful links into the Java course - Note that all Java methods are like C++ virtual methods - the 2 programs below won't print out the same thing unless Shape::draw() is made virtual in the C++ program.
Java        C++
class Shape {
  void draw(){System.out.println("Drawing a shape\n"); }
};

class Triangle extends Shape {
  void draw() {System.out.println("Drawing a triangle\n"); }
};

class Square extends Shape {
  void draw() {System.out.println("Drawing a square\n"); }
};

class shapes{
    static public void main (String[] args) {
    Shape t1 = new Triangle();
    Shape s1 = new Square();
    t1.draw();
    s1.draw();
    }
}
        
#include <iostream>

class Shape {
public:
  void draw(){ std::cout << "Drawing a shape\n"; };
};

class Triangle: public Shape {
  void draw() {std::cout << "Drawing a triangle\n"; };
};

class Square: public Shape {
  void draw() {std::cout << "Drawing a square\n"; };
};

int main(){
    Triangle t;
    Square s;
    Shape t1=t;
    Shape s2=s;
    t1.draw();
    s2.draw();
}

idlj is installed (it converts IDL files to Java).

© Cambridge University Engineering Dept
Information provided by Tim Love (tpl)
(with help from various COs).
Last updated: June 2002