How can I separate the digits of an int number in Java?

in Java
Java Tutorials
1 Answers to this question

he process to separate the digits of an integer number using Java is simple. Below is the code that is used to separate the digits of an integer number. 

public static void main(String[] args) 

{


int n=1000; // int number


while (n > 0) {


    System.out.println( n % 10);


    n = n / 10;


}


}

If you want to unleash your potential in this competitive field, please visit the Java Certification Training page for more information, where you can find the       and    Java Interview Questions FAQ's and answers    as well.

For more updates on the latest courses stay tuned to HKR Trainings.

To Top