Skip to content

Instantly share code, notes, and snippets.

@Godin
Created February 14, 2012 08:28
Show Gist options
  • Save Godin/1824801 to your computer and use it in GitHub Desktop.
Save Godin/1824801 to your computer and use it in GitHub Desktop.
$ javac -version -source 1.5 -target 1.5 Test.java
javac 1.5.0_22
Test.java:7: method does not override a method from its superclass
@Override
^
1 error
$ javac -version -source 1.5 -target 1.5 Test.java
javac 1.6.0_30
$ javap Test -v
Compiled from "Test.java"
public class Test extends java.lang.Object
SourceFile: "Test.java"
InnerClass:
public #9= #3 of #7; //MyClass=class Test$MyClass of class Test
public abstract #12= #11 of #7; //MyInterface=class Test$MyInterface of class Test
minor version: 0
major version: 49
$ java -version
java version "1.5.0_22"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_22-b03)
Java HotSpot(TM) Server VM (build 1.5.0_22-b03, mixed mode)
$ java Test
Hello world!
public class Test {
public interface MyInterface {
String method();
}
public static class MyClass implements MyInterface {
@Override
public String method() {
return "Hello world!";
}
}
public static void main(String[] args) {
System.out.println(new MyClass().method());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment