Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class HelloWorld {
- public static void main(String[] args) {
- final var nameParts = (args.length == 0) ? new String[]{"world"} : args;
- System.out.println(formatMessageWithName(nameParts));
- }
- private static String formatMessageWithName(final String[] nameParts) {
- return "Hello " + String.join(" ", nameParts) + "!";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement