Actually, I was excuting a perticular program, as shown in Picture below…
1st Case : Running the same.java file with default Run option in Intellij IDE
–> Gives the correct output ( you can see in pic )
2nd Case : Running the same.java file with command javac same.java in Terminal
error: cannot find symbol
anotherClass.main(new String[]{"aditya"});
^
symbol: variable anotherClass
location: class same
Why Is that Issue…
As of I know In java by default the "java.lang" and the "current working directory" packages are by default imported…
>Solution :
When you run code from IDE, the IDE compiles all the classes in your project. When you run code from the command prompt, YOU must compile all the necessary classes. In this case, you didn’t compile anotherClass.
Here is a link on how to compile multiple files from command line: https://docs.oracle.com/en/java/javase/13/docs/specs/man/javac.html. Go down to the section "Example of Compiling Multiple Source Files"
As a side note, use proper naming conventions. The industry-accepted naming convention for classes is "CamelCase".

