Skip to content

Instantly share code, notes, and snippets.

@brianduff
Last active September 29, 2020 06:45
Show Gist options
  • Save brianduff/b3815d9256869970875f4bb8ab82585b to your computer and use it in GitHub Desktop.
Save brianduff/b3815d9256869970875f4bb8ab82585b to your computer and use it in GitHub Desktop.
package frodo;
public class Example {
public static void main(String[] args) {
new Test().run();
}
public void run() {
System.out.println(someMethod(new RealFile("/foo")));
System.out.println(someMethod(new RealFile("/bar")));
}
public String someMethod(RealFile file) {
return "Hello " + file.getPath();
}
private static class RealFile {
private final String path;
RealFile(String path) { this.path = path; }
public String getPath() { return path; }
public String toString() {
return "A file called " + getPath();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment