
Asked in TCS
Explain the execution flow of static blocks, instance blocks, and methods in Java.

Static blocks run once at class loading; instance blocks run for each object; methods execute as called, following the order of execution.
Static blocks are executed when the class is loaded into memor...read more
In Java, there are several types of blocks that can be used to define code:
Static blocks: Static blocks are blocks of code that are marked with the
static
keyword and are executed when the class is fi...read more
static block is a set of instructions that is run only once when a class is loaded into memory
Class Hello {
static{
System.out.println("hello static"):
}}
Instance black is similar to method which h...read more
A static block is a block of code with a static keyword. In general, these are used to initialize the static members of a class. JVM executes static blocks before the main method at the time loading a...read more
Static Block - a static block is a set of instructions that is run only once when a class is loaded into memory.
Instance Block - it is an element of a class which serves the same two purposes as serv...read more
Top Java Developer Interview Questions Asked at TCS
Interview Questions Asked to Java Developer at Other Companies
Top Skill-Based Questions for TCS Java Developer


Reviews
Interviews
Salaries
Users

