Java programming interview questions:
- What is immutable object? Can you write immutable object?
- Immutable classes are java classes whose object can not be modified once created. Any modification in Immutable object result in new object. For example String is immutable object. Mostly immutable are also final in order to prevent sub class to overriding method in Java. You can achieve the same functionality by making member as non final but private and not modifying them except constructors.
- What is Static and Dynamic binding in Java
- Overloading and Overriding method
- How to override compareTo method
- final variable, method and class in Java
- What is static variable, class, method and keyword in Java
- static keyword may be applied with variable, method or nested class (cannot be applied with top level class)
- static variables are asociated with class instead of object, and keeps same value for every single object
- you can not use non-static variable inside a static method
- static binding, class loading
- How Garbage collector works, and how System.gc() method works
- What is reflection
- Reflection is the ability of running program to examine/analyse itself and its software environment. To perform this self-examination, a program needs to have a representation of itself. This information we call metadata. In object oriented world metadata is organized into objects, called metaobjects and the run time self examination of the metaobjects is called introspection.
- I didn't use reflection very oftenby myself, but I know that it is used in many java frameworks - for example Spring container uses reflection to create the objects.
- Why main method is static in Java
- Class loading in Java
Brak komentarzy:
Prześlij komentarz