Advertisement
JeffGrigg

Untitled

Apr 2nd, 2021
2,333
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 0.37 KB | None | 0 0
  1. public class HelloWorld {
  2.  
  3.     public static void main(String[] args) {
  4.         final var nameParts = (args.length == 0) ? new String[]{"world"} : args;
  5.         System.out.println(formatMessageWithName(nameParts));
  6.     }
  7.  
  8.     private static String formatMessageWithName(final String[] nameParts) {
  9.         return "Hello " + String.join(" ", nameParts) + "!";
  10.     }
  11.  
  12. }
  13.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement