Skip to content

Instantly share code, notes, and snippets.

@tmountain
Created January 22, 2010 18:21
Show Gist options
  • Save tmountain/283998 to your computer and use it in GitHub Desktop.
Save tmountain/283998 to your computer and use it in GitHub Desktop.
// Vehicle.java
public interface Vehicle {
public int wheels();
}
// Test.java
public class Test {
public static void main(String[] args) {
Vehicle car = new Vehicle() {
public int wheels() {
return 4;
}
};
System.out.println("A car has " + String.valueOf(car.wheels()) + " wheels.");
}
}
// prints "A car has 4 sheels."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment