Check out example codes for "how to write a programme to display all the factors of a number in java". It will help you in understanding the concepts better.

Code Example 1

public class Factors {

    public static void main(String[] args) {

        int number = 60;

        System.out.print("Factors of " + number + " are: ");
        for(int i = 1; i <= number; ++i) {
            if (number % i == 0) {
                System.out.print(i + " ");
            }
        }
    }
}

Learn ReactJs, React Native from akashmittal.com