What is the use of static block in Java?
Static block is mostly used for changing the default values of static variables.This block gets executed when the class is loaded in the memory. A class can have multiple Static blocks, which will execute in the same sequence in which they have been written into the program.
-----------------------------------------------
What is static initialization in Java?
The static initializer is a static {} block of code inside java class, and run only one time before the constructor or main method is called
===============================================
//Static block and initialize block
class X
{
//Static block
static
{
System.out.println("This Is A Static-2");
}
// initialize block
{
System.out.println("this is initialize block");
}
X()
{
System.out.println("OBJ Create");
}
public static void main(String []s)
{
System.out.println("Start");
System.out.println("End");
}
static
{
System.out.println("This Is A Static-1");
}
}
===================================
static initialization block in java,
java static initializer block hackerrank solution,
why static block executed first in java,
java initializer block,
java initialization block vs constructor,
static initialization c++,
java instance initializer,
non static block in java,
www.saprahits.com
www.patelwala.com
www.readranks.com
~-~~-~~~-~~-~
Please watch: "How to online money earn from Flipkart without selling any products"
• Video
~-~~-~~~-~~-~
In questa pagina del sito puoi guardare il video online Static and initialize block in JAVA della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Inside App 14 febbraio 2017, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 222 volte e gli è piaciuto 2 spettatori. Buona visione!