in Education by
What is the static block?

1 Answer

0 votes
by
Static block is used to initialize the static data member. It is executed before the main method, at the time of classloading. class A2{ static{System.out.println("static block is invoked");} public static void main(String args[]){ System.out.println("Hello main"); } } Test it Now Output: static block is invoked Hello main

Related questions

0 votes
    Can abstract keyword be used with constructor, Initialization Block, Instance Initialization and Static Initialization ... Java Select the correct answer from above options...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    What should be the execution order, if a class has a method, static block, instance block, and ... stackoverflow.com 🔗Source: Java Interview Questions and Answers...
asked Dec 19, 2020 in Technology by Editorial Staff
0 votes
    What is a Genesis Block in Blockchain?...
asked Jan 22, 2023 in Technology by JackTerrance
0 votes
    How to identify a block in Blockchain?...
asked Jan 22, 2023 in Technology by JackTerrance
0 votes
    The client expects a timely response from the service and might even block while it waits. This represents the _________ client ... B. One to one C. One to many D. Synchronous...
asked Jan 10, 2023 in Technology by JackTerrance
0 votes
    Source coding block is used for? a) Compressing b) Digitizing c) A/D conversion d) All of the mentioned...
asked Dec 31, 2022 in Technology by JackTerrance
0 votes
    Pulse shaping is done by which block or system? a) Encoder b) Baseband modulator c) Pulse code modulator d) Demodulator...
asked Dec 31, 2022 in Technology by JackTerrance
0 votes
    Which block or device does the data compression? a) Channel encoder b) Source encoder c) Modulator d) None of the mentioned...
asked Dec 29, 2022 in Education by JackTerrance
0 votes
    _____ contains hash of previous block and all the important information required by the block. A. Block Header B. Block Metadata C. Chain D. Block Footer...
asked Nov 23, 2022 in Education by JackTerrance
0 votes
    I can use vi{ and va{ to select C++ code blocks. It helps me a lot when I need to yank ... questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Aug 1, 2022 in Education by JackTerrance
0 votes
    I'm not advanced programmer in SQL and maybe my question is silly, but I haven't found an answer ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 2, 2022 in Education by JackTerrance
0 votes
    As I understand it, if there are only messages with a timestamp for the future in a MessageQueue, the ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 2, 2022 in Education by JackTerrance
0 votes
    I had a program working good (without prompting errors) using references, but I decided to use a pointer-to-pointer array ... that it is there because I have put two flags (cout...
asked Apr 6, 2022 in Education by JackTerrance
0 votes
    Considering this code, can I be absolutely sure that the finally block always executes, no matter what ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 25, 2022 in Education by JackTerrance
...