If I give values like a = 1234, I want to print only the last two digits 34. Can someone give me a solution for this ...
int a=1234; System.out.print(a);
number % 100 will result in the last two digits
number % 100
Cm
User modulo 100
System.out.print(String.format("%02d", (abs(a)%100)));
You can try it too
int a=1234; System.out.print(String.valueOf(a).substring(2));
Out put
34