Created
December 2, 2018 21:59
-
-
Save uberto/c37970ba1d3b49c61568809085a84d1f to your computer and use it in GitHub Desktop.
Create and export anonymous classes
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
package com.gamasoft.memoryReferences; | |
import java.util.Observable; | |
public class Factory { | |
public Runnable createRunnable() { | |
return new Runnable() { | |
@Override | |
public void run() { | |
System.out.println("run"); | |
} | |
}; | |
} | |
static public Runnable createStaticRunnable() { | |
return new Runnable() { | |
@Override | |
public void run() { | |
System.out.println("run"); | |
} | |
}; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Verify the presence of inner field with this test
`
package com.gamasoft.memoryReferences;
import org.junit.Test;
import java.lang.reflect.Field;
import static org.junit.Assert.*;
public class FactoryTest {
}
`