Java: charAt convert to int?

前端 未结 6 1182
粉色の甜心
粉色の甜心 2020-12-20 14:39

I would like to key in my nirc number e.g. S1234567I and then put 1234567 individualy as a integer as indiv1 as cha

6条回答
  •  感动是毒
    2020-12-20 15:26

    try {
       int indiv1 = Integer.parseInt ("" + nric.charAt(1));
       System.out.println(indiv1);
    } catch (NumberFormatException npe) {
       handleException (npe);
    }
    

提交回复
热议问题