Static and initialize block in JAVA

Publicado em: 14 Fevereiro 2017
no canal de: Inside App
222
2

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  
~-~~-~~~-~~-~


Nesta página do site você pode assistir ao vídeo on-line Static and initialize block in JAVA duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Inside App 14 Fevereiro 2017, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 222 vezes e gostou 2 espectadores. Boa visualização!