title: Java text to ASCII converter with a loop
body: <p>I'm trying to my first program text to ASCII converter, but I have some problems, it's explained inside the code:</p>
  
  <pre><code>import java.util.Scanner;
  
  public class AsciiConverter {
  
      public static void main(String[] args){
          System.out.println("Write some text here");
          Scanner scanner = new Scanner(System.in).useDelimiter("\\n"); // Scans whole text
          String myChars = scanner.next();
          int lenght = myChars.length(); // Checking length of text to use it as "while" ending value  
          int i = -1;
          int j = 0;
          do{
              String convert = myChars.substring(i++,j++); // taking first char, should be (0,1)...(1,2)... etc 
              int ascii = ('convert'/1); // I'm trying to do this, so it will show ascii code instead of letter, error: invalid character constant
              System.out.print(ascii); // Should convert all text to ascii symbols
          }
          while(j &lt; lenght );
          scanner.close();
      }
  }
  </code></pre>