Static and initialize block in JAVA

Veröffentlicht am: 14 Februar 2017
auf dem Kanal: 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  
~-~~-~~~-~~-~


Auf dieser Seite können Sie das Online-Video Static and initialize block in JAVA mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Inside App 14 Februar 2017 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 222 Mal angesehen und es wurde von 2 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!