dimanche 6 septembre 2015

compare a variable but i want just to consider the first digit in java

I am trying to compare a variable but i want to consider the first digit. if item is 1 and I compare it with these values for AA {1,11,12} it will work in all of these values but I want to work just if AA = 1 and does not work with the rest . how can I do that. In the same time I want to deal with the AA as an integer.

                if (item == AA) {

                System.out.println("AA ");
            }

Aucun commentaire:

Enregistrer un commentaire