Created
September 15, 2020 11:20
-
-
Save om26er/a92936bed567b01294b059c533f76eb2 to your computer and use it in GitHub Desktop.
Java print function like Python
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
private void print(Object ...args) { | |
StringBuilder builder = new StringBuilder(); | |
for (int i = 0; i < args.length; i++) { | |
if (i == args.length - 1) { | |
builder.append(args[i]); | |
} else { | |
builder.append(args[i]).append(" "); | |
} | |
} | |
System.out.println(builder.toString()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment