- Home
- Interview Questions
- Java
Static modifier can be applied to variables,methods, and even a code that is not part of a method.
We can think of static features as belonging to a class, rather than being associated with an individual instance of the class.
The native modifier can refer only to methods. native modifier indicates that the body of a method is to be found like the abstract modifier.
Native code is written in a non java language typically C or C++ and compiled for a single target machine type.
In the case of abstract methods, the body is in a subclass; with native methods, the body lies entirely outside the JVM in a library.
The transient modifier applies only to variables. A transient variable is not stored as part of its object's persistent state.
When a class defines a method in its superclass using the same name, return type, and arguments as a method, that method in the class overrides the method in the super class.
Nested top-level classes, Member classes, Local classes, Anonymous classes.