Skip to content

Instantly share code, notes, and snippets.

@reynoldsm88
Created October 24, 2016 19:20
Show Gist options
  • Save reynoldsm88/ceb9b44d60628b81b65fce1c8f747c62 to your computer and use it in GitHub Desktop.
Save reynoldsm88/ceb9b44d60628b81b65fce1c8f747c62 to your computer and use it in GitHub Desktop.
public class MySuperClass {
private Map<String,String> values;
// static initializer parent
{
values = new HashMap<String,String>();
values.put( "value", "super" );
}
public void doSomething( String s ){
this.values.get( s ); // expect it to return "super"
}
}
public class MySubClass(){
private Map<String,String> values;
// static initializer subclass
{
values = new HashMap<String,String>();
values.put( "value", "sub" );
}
public void doSomething( String s ){
this.values.get( s ); // expect it to return sub
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment