Javaに投稿されたコード一覧
public class Main {
public static void main(String[] args) {
Foo foo = FooFactory.createFoo(); // Fooの生成はファクトリに任せる
public class Main {
public static void main(String[] args) {
Foo foo = new FooProxy(); // ここだけ変わる
foo.foo();
public class FooProxy implements Foo {
private FooImpl fooImpl = new FooImpl();
public class FooImpl implements Foo {
@Override
public void foo() {
System.out.println("foo");
public interface Foo {
public void foo();
public void bar();
public class Foo {
public void foo() {
try {
System.out.println("foo start");
public class Main {
public static void main(String[] args) {
Foo foo = new Foo();
foo.foo();
public static String getMethdodName() {
StackTraceElement stackTraceElement = Thread.currentThread().getStackTrace()[2];
String className = stackTraceElement.getClassName();
String methodName = stackTraceElement.getMethodName();
return className + "." + methodName;
/* 2値化のしきい値 */
public static final double THRESHOLD = 128;
/* 2値化のサンプル */
private static void doProcess() {