Java Interview Questions and Answers
what is class?
Class is a blue print from which individual objects are created. A class can contain fields, methods to describe the behavior of an object.
What is object?
Object is a runtime entity and it’s state is defined in the fields and behavior in methods. Methods operate on an object's internal state and serve as the primary key for object-to-object communication.
What is access modifiers?
Access modifiers are to set the access levels for classes, variables, methods and constructors. A member has package or default accessibility when no accessibility modifier is specified.
Any five feature of java programming language?
Object oriented, Platform independent, Robust, Interpreted, Multi-threaded.
What is immutable class?
Immutable class is that once an object is created, we cannot change its content. In Java, all the wrapper classes and String class is immutable.
Why String class is considered immutable ?
String class is considered immutable,as once it is created a String object can't be changed. Since String is immutable it can safely be shared between many threads ,which is important for multithreaded programming.