Incidentally one thing came to my mind.
Every time I write algorithm in java I run it via main fucntion.
Main function always look like this. “public static void main(String[] args)…”
Here goes my silly question. “if i want to run only one class and not expecting to expose it why do i need ‘public’ keyword?”
So I ran it without ‘public’ and the program spewed out error.
According to https://www.journaldev.com/12552/public-static-void-main-string-args-java-main-method the main function needs to have public access modifier.
That is the only way java runtime can execute my algorithm.