My question is why you write this word ( result = result * a; ) everyone can you explain this word

Scanner er = new Scanner(System.in);
int a = er.nextInt();
int b = er.nextInt();
int result = 1;

    for(int i = 0; i < b; i++){
        result = result * a;
    }
    System.out.println(result);

my question is why you write this word ( result = result * a; )
everyone can you explain this word

For a^b (a power b), you need to multiply a for b times. To store the result, use another variable by initialising it to 1. If u initialise it to 0, and will always be 0. So indeed u r multiplying a for b times