Created
January 22, 2010 18:21
-
-
Save tmountain/283998 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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