block « Static Class « Java Class Q&A

Home
Java Class Q&A
1.abstract class
2.Base class
3.class hierarchy
4.class name
5.class version
6.Class.forName
7.ClassCastException
8.Clone
9.constant
10.Constructor
11.Development
12.DTO
13.encapsulation
14.equal method
15.extend Class
16.getter
17.hashcode
18.Inheritance
19.inner class
20.interface
21.main class
22.Method
23.NoClassDefFoundError
24.NoSuchMethodError
25.NoSuchMethodException
26.object reference
27.overload
28.parent class
29.Polymorphism
30.private
31.Private Field
32.Recursive
33.setter
34.Static
35.Static Class
36.subclass
37.Super
38.toString
39.Wrapper Class
Java Class Q&A » Static Class » block 

1. Is there any way static block is executed more than once? if so then how?    stackoverflow.com

My Understanding Static block is executed during class loading, If a class is already loaded then there is no way to load the class other than class reloading Doubt/Question 1) Is there any time ...

2. What does the "static" block in following class does?    coderanch.com

Hi, I have static block as follows in my java class:- public class SimpleWeb extends Thread { static { String image = "image/"; MIME_TYPES.put(".gif", image + "gif"); MIME_TYPES.put(".jpg", image + "jpeg"); MIME_TYPES.put(".jpeg", image + "jpeg"); MIME_TYPES.put(".png", image + "png"); String text = "text/"; MIME_TYPES.put(".html", text + "html"); MIME_TYPES.put(".htm", text + "html"); MIME_TYPES.put(".txt", text + "plain"); } //other methods in class } ...

3. static block reading values from other class static block    coderanch.com

Hi, I have one static class , say , Database.java and other class DbConnection.java. I have static block in both classes. Can I use static variable values from one class into static block of another class. I mean what happens if second class gets loaded ( JVM ) earlier than second class. Will first class's value be null ? For example ...

5. static blocks run at class loading    coderanch.com

hi all, I have come know that static blocks run when the class is loaded for the first time.But if this is the case ,then in the following code- class supA { static{System.out.println("supA's static block");} } class supB extends supA { static{System.out.println("supB's static block");} } class supC extends supB { static{System.out.println("supC's static block");} public static void main(String[]a) { } } when ...

java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.