Last active
September 29, 2020 06:45
-
-
Save brianduff/b3815d9256869970875f4bb8ab82585b to your computer and use it in GitHub Desktop.
This file contains 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 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