title: Cannot return modified String from static method
body: <p>Im very new to coding and cant seem to be able to return anything. I need to convert upper case characters to lower case and vice versa. Here's my code: </p>
  
  <pre><code>public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      String str = sc.nextLine();
      invString(str);
      sc.close();
  
  }
  
  private static String invString(String str) {
      for (int i = 0; i &lt; str.length(); i++) {
          char ch = str.charAt(i);
          if (ch &gt; 97) {
              ch = Character.toUpperCase(ch);
              return str;
          } else {
              ch = Character.toLowerCase(ch);
              return str;
          }
      }
      return null;
  }
  </code></pre>
  
  <p>What am i doing wrong? ( in terms of returning, the code isnt complete yet)</p>
  
  <p>EDIT****************</p>
  
  <p>thanks for the helpful remarks, as i understood i do not have a place where my modifications are stored, so i added  <code>String res = "";</code> and kept adding the values into <code>String res</code> but in the end, when returning res, i still dont get any output...Here is the whole thing: </p>
  
  <pre><code>public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      String str = sc.nextLine();
      String st = invString(str);
      sc.close();
  
  }
  
  private static String invString(String str) {
      String res = "";
      for (int i = 0; i &lt; str.length(); i++) {
          char ch = str.charAt(i);
  
          if (65 &lt;= ch &amp;&amp; ch &lt;= 90) {
              ch += 32;
              res += ch;
  
          } else if (97 &lt;= ch &amp;&amp; ch &lt;= 122) {
              ch -= 32;
              res += ch;
          }
  
  
      }
  
      return res;
  }
  </code></pre>
  
  <p>ps. Im not using the ready methods because my task asks for it. </p>