About onClick function

pulkit sir taught in the prev videos that while using onClick method we need to write fun function_name(parameters) but here in this video arnav sir is writing public void function_name(parameters).
Which 1 should i prefer?

Both the syntax are the same could you please clarify which two approaches are you asking here?

in button onClick method do we need to write public void or just the function name?

Writing public void functionName() is way of declaring functions in java without return type you can’t define functions in java