The static block is only loaded when the class object is created by the JVM for the 1st time whereas init {} block is loaded every time class object is created. Also first the static block is loaded then the init block.
public class LoadingBlocks {
static{
System.out.println("Inside static");
}
{
System.out.println("Inside init");
}
public static void main(String args[]){
new LoadingBlocks();
new LoadingBlocks();
new LoadingBlocks();
}
}
Output:
Inside static
Inside init
Inside init
Inside init
hmmmmmmmmm nice info… very nice keep it up deear…..
very good explanation…..!!!
Simply superb.
Dear Belle :I don’t think that we have a VB implemenation of Apriori Algorithm on this site and I do not know of any other site that may have one.But I do know that the comumnity at has a popular java implementation of Apriori with full source code.Please let me know if I can be of more service to you.Thanks Was this answer helpful?
PHThUK xzkbyuxjvpoc
It’s about time somoene wrote about this.
g
Static block get called only once at very first when the class is loaded by the JVM, It will be called even if no object of this class is created but init block is called every time u create an object of the class, init is like constructor calling be u can not pass parameters to constructor.
Nice
without object create static block call. and static block is always executed one time.
Static block is executed even if you don’t create object and therefore static block code run when jvm loads the class