Hi Ranchers!
I have a doubt regarding uses of transient modifier ,let me explore my doubt . As i know, transient modifier only can be used in the case of variable , i got surprise when i found that jvm internally append transient modifier in main method only in the case of an abstract class which is going to inherited by its child class....I would like to show the scenario first, please have a look at below code....
abstract class AbstractDemo{
}
class SubAbstractDemo extends AbstractDemo{
public static void main(String...args){
}
}
when i compiled above code and decompiled child class SubAbstractDemo ,i really got surprise when i saw the following below code......
class SubAbstractDemo extends AbstractDemo
{
SubAbstractDemo()
{
}
public static
transient void main(
String args[])
{
}
}
here jvm insert transient modifier internally but when i did it explicitly then i faced compile time error saying modifier transient not allowed here.
how it happens?? m confused??? and what is mean here to use transient in the case of main() method...
please give me reason why ?? and how??
thanks for your valuable time.