Learning Java: How to make a short alias for System.out.println() -
i make alias of or extended version of system.out.println()
printing variables of various types. how 1 pass argument unknown type/class method?
public static void p(variabletype... args) { system.out.println(args[0]); // ... }
unless want lots of lines in output, do.
public static <printabletostring> void p(printabletostring... args) { for(printabletostring pts: args) system.out.print(pts); system.out.println(); }
Comments
Post a Comment