title: Java Lexical Analyzer
body: <p>i'm creating a lexical analyzer. in my code i can output the symbols, but when it comes to letters and numbers i cant design what will be my code in that.. </p>
  
  <p>please help me in my project.. thanks</p>
  
  <pre><code>package lab7;
  
  import java.util.Scanner;
  import java.util.StringTokenizer;
  
  public class Lab7 {
  public static void main(String[] args) {
                  String word;
          char[] wordArray;
  
          Scanner sc = new Scanner(System.in);
  
          wordArray = word.toCharArray();
  
          for(int x = 0; x &lt; wordArray.length; x++) {
  
              if(wordArray[x] == '+') {
                  System.out.print("ADD ");
              }
              else if(wordArray[x] == '-') {
                  System.out.print("SUBTRACT ");
              }
              else if(wordArray[x] == '*') {
                  System.out.print("MULTIPLY ");
              }
              else if(wordArray[x] == '/') {
                  System.out.print("DIVIDE ");
              }
              else if(wordArray[x] == '(') {
                  System.out.print("MATH ");
              }
              else if(wordArray[x] == ')') {
                  System.out.print("MATH ");
              }
              else if(wordArray[x] == '=') {
                  System.out.print("ASSIGN ");
              }
  
          }
      }
  }
  </code></pre>