What is Synchronized Modifier Used For

It is used to control access of critical code in multithreaded programs. In Java, the synchronized modifier is used to control access to a block of code or a method by multiple threads. When a method or a block of code is declared as synchronized, only one thread can access it at a time. This … Read more

What Are Transient Variables

A transient variable is not stored as part of objects persistent state and they cannot be final or static. In Java, the transient keyword is used in the context of instance variables to indicate that the variable should not be serialized during the process of object serialization. Serialization is the process of converting an object … Read more

Where is Native Modifier Used

It can refer only to methods and it indicates that the body of the method is to be found else where and it is usually written in non java language. In Core Java, the native modifier is used in method declarations to indicate that the method is implemented in a language other than Java, typically … Read more

What is Static Initializer Code

: A class can have a block of initializer code that is simply surrounded by curly braces and labeled as static e.g. Code: public class Demo{ static int =10; static{ System.out.println(�Hello world�); } } And this code is executed exactly once at the time of class load In Java, a static initializer block is a … Read more

Can Static Method Use Non Static Features of There Class

No they are not allowed to use non static features of the class, they can only call static methods and can use static data. No, a static method in Java cannot directly access non-static (instance) members of its class. Static methods are associated with the class itself, rather than with any specific instance of the … Read more