title: How to create a method to display the result of the following array program?
body: <p>Below is the code that I have been able to develop- but I having trouble to create a code to display the result.</p>
  
  <pre><code>import java.util.Scanner;
  
  public class Student2 {
  
      public static void main(String[] args) {
          String name= "";
          char[] array;
          Scanner input= new Scanner(System.in);
  
          System.out.print("Please enter a word: ");
          name= input.nextLine();
          array= tally(name);
          input.close();
      }
      public static char[] tally(String name){
          char[] charArray= name.toCharArray();
          char[] arr= name.toCharArray();
  
          for (int count=0; count&lt;name.length(); count= count+1){
              arr[count]= (char)(arr[count]);
              System.out.println(name.charAt(count) +"\t"+(int)arr[count]);   
          }
          return charArray;
      }
  }
  </code></pre>