Tags:JAVA Questions | 71 views
Java Access Specifiers
The access to classes, constructors, methods and fields are regulated using access modifiers i.e. a class can control what information or data can be accessible by other classes. To take advantage of encapsulation, you should minimize access whenever possible.
Java provides a number of access modifiers to help you set the level of access [...]
Tags:JAVA Questions | 46 views
User defined Exceptions are custom Exception classes defined by the user for specific purpose. A user defined exception can be created by simply sub-classing an Exception class or a subclass of an Exception class. This allows custom exceptions to be generated (using throw clause) and caught in the same way as normal exceptions.
Example:
class CustomException extends [...]
Tags:JAVA Questions | 66 views
What is the difference between Abstract class and Interface
Or
When should you use an abstract class, when an interface, when both?
Or
What is similarities/difference between an Abstract class and Interface?
Or
What is the difference between interface and an abstract class?1. Abstract class is a class which contain one or more abstract methods, which has to be implemented by [...]
Tags:JAVA Questions | 44 views
What restrictions are placed on method overloading?Two methods may not have the same name and argument list but different return types.
What is the difference between String and StringBuffer?
String objects are immutable whereas StringBuffer objects are not. StringBuffer unlike Strings support growable and modifiable strings.
Can a private method of a superclass be declared within a subclass?
Sure. [...]