0

Hello guys I just started learning java and I'm got my name in ascii numbers in a int array and i'm trying to loop thru it while casting each int ascii to a char

package program1;

/**
 *
 * @author Gust-X
 */
public class Program1 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {

        int[] firstName;
        firstName = new int[6];

        firstName[0] = 071;
        firstName[1] = 117;
        firstName[2] = 115;
        firstName[3] = 116;
        firstName[4] = 097;
        firstName[5] = 118;


        for(int x = 0; x < 6; ++x ){
            System.out.print((char)firstName[x]);
        }
        // TODO code application logic here
    }

}

I get a red line under firstName[4] = 097; saying integer number too large 097

GustX
  • 45
  • 1
  • 10

0 Answers0