2021-07-29 工作應用/鬼故事 Company Ghost Story 公司鬼故事 11 contents 1. Java1.1. Over Overload1.2. One-Format Multiple-Ways JavaOver Overload1234567891011121314class OhMyGod { public void run() {System.out.println("A");} public void run(String t) {System.out.println("B");} public <T> void run(T[] t) {System.out.println("C");} public <T> void run(T t) {System.out.println("D");} public static void run(String... t) {System.out.println("E");} public static void main(String[] args) { new OhMyGod().run(); new OhMyGod().run(new String[0]); new OhMyGod().run("1"); new OhMyGod().run("1", "2"); }} // AEBE, little strange One-Format Multiple-Ways12345678910111213141516class FileIn { private boolean isCSV; // why not enum private boolean isXML; private boolean isJSON; public void setIsCSV(boolean e) {isCSV = e;} public void setIsXML(boolean e) {isXML = e;} public void setIsJSON(boolean e) {isJSON = e;} public void import(File file) { // why not if-else if (isCSV) CSVIn(file); //??? if (isXML) XMLIn(file); //??? if (isJSON) JSONIn(file); //??? }} Newer Java JNI GC Thread Error (EINVAL) Older 疫情下的工作變化