Hi Team,
Let me first present my understanding of how scala complies and run and then in the subsequent comments i would explain the issue.
When whenever we write a code in java with singleton object as mentioned below
1)I have created a new directory scala,inside this directory i have created a file MyScala
and this file contains the below code:
object MyScala{
def main(args: Array[String]){
println (“MyScala”)
}
}
Icomplied the above file using scalac and ran it using scala commands
When iam trying to decompile it using javap:PFB
It seems that the main method that i defined in my singleton object in scala gets converted to public static main function in java and thats how JVM is able to execute the code after the scala complier converts the above code into java byte code.
Please correct my understanding if iam wrong.