title: How do I print just the even or odd chars in an array?
body: <p>Lets say I have string: 'firetruck'. And I split that string up into the individual letters and put them into an array called T for example. So now T[] looks like {f,i,r,e,t,r,u,c,k}. How can I just print the even chars so my print statement looks like 'frtuk' and the odd looks like 'ierc'. This is what I got so far:</p>
  
  <pre><code>import java.util.Scanner;
  import java.util.Arrays;
  public class StringFun {
  
      public static void main(String[] args) {
          Scanner sc = new Scanner(System.in);
  
          String even_odd = sc.next();
          char[] t = even_odd.toCharArray();
          System.out.println(Arrays.toString(t));
  
          //I can't get this next part to work.
          for(int i = t[0]; i &lt; t.length; i = i + 2){
              System.out.println(Arrays.toString(t[i]));
          }
      }
  }
  </code></pre>