waltermilner

Untitled

Jan 27th, 2015
338
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.37 KB | None | 0 0
  1.     public static String[] swap(String s1, String s2) {
  2.         String[] val = new String[2];
  3.         val[0] = s2;
  4.         val[1] = s1;
  5.         return val;
  6.     }
  7.  
  8.     public static void main(String[] args) {
  9.         String s1 = "hello";
  10.         String s2 = "bye";
  11.         String[] s = swap(s1, s2);
  12.         System.out.println(s[0] + " " + s[1]); // bye hello
  13.     }
Advertisement
Add Comment
Please, Sign In to add comment