What are Static Blocks and Non Static Blocks Initializes IN Java -Hindi
[caption id="attachment_548" align="alignnone" width="300"]
आज हम बात करेंगे static and non static block के बारे में तो चलिए जानते हैं उसके बारे में details .
Static Blocks And It Execution-
Hindi में -Static Variables को initializing करने केलिए static block का use किया जाता है .यदि किसी block के आगे static लिखा हुआ होगा तो इसे static block कहा जाता है .जब class memory में loaded हो जाता है उशी time static block executed होजाता है . static block constructor executed होने से पहले executed हो जाता है .
English में -Static block ius used for initializing the static variables .this block get executed when the class is loaded in the memory .static blocks are executed even before the constructor executed .
example-
static{
// code for static block
}
non Static Blocks And It Execution-
Hindi में -एक non static block तब execute होता है जब object create होता है .यह भी constructor पहेले execute होता है .जब किसी block के पहेले static ना लिखा हो .यदि किसी class में बहुत सारे non static block हैं तो तब जैसे class में देफिंद किया गया है उशी तरह execute होगा .
English में -A non-static block executes when the object is created, before the constructor .There is no keyword prefix to make a block non-static block,unlike static blocks. Incase of multiple non-static blocks , the block executes the order in which it is defined in the class.
example-
{
// non static block
}
आपको कुछ भी problem ही java से जुडी जानकारी से तो आप हमें comment section में comment कर सकते हैं .में अभी एक software developer हूँ मुझे पता है आपको कैसा पढना है .यह था आज का टॉपिक reserved keywords के बारे में .उम्मीद करता हूँ आप लोगो को यह आर्टिकल पसंद आया होगा यदि आया है .
तो आपके दोस्तों के साथ शेयर करें .
nicehindi.com
0 Comments