title: Swap strings in Java. Beginner in Java
body: <p>What I'm trying to do: Given a string from user, swap the first half with second half. If the string length is odd, take the lower first half and swap. And if the string length is 1, leave it alone.
  For Example:</p>
  
  <p>Input: <code>abcde</code></p>
  
  <p>Output: <code>cdeab</code></p>
  
  <p>Don't know how to deal with strings exactly in java! I'm losing confidence here..</p>
  
  <pre><code>import java.util.*;
  
  class Swap {
      public static void main (String[] args) {
          Scanner in = new Scanner(System.in);
          System.out.println("Enter a string");
          String s = in.nextLine();
          int length = s.length();
  
          System.out.println(length);
  
          int x = length/2;
  
          if (x % 2 = 0) {
              for (int i =0; i&lt;x; i++) {
                  String s[] array1 ;
              }
          }
      }
  }
  </code></pre>