Very Short Questions Spring 2016
The answers to very short questions of spring 2016 are given below:
- List any four java buzzwords.
ANS-The four java buzzwords are given below:
2. Explain JDK and JRE in brief.
ANS- JDK is an acronym for Java Development Kit. The Java Development Kit (JDK) is a software development environment that is used to develop Java applications and applets. It physically exists. It contains JRE + development tools.
JRE is an acronym for Java Runtime Environment. It is also written as Java RTE. The Java Runtime Environment is a set of software tools that are used for developing Java applications.
3. Variables in the interface are by default abstract and private. Is it? Justify.
ANS- No, the variables int he interfaces are by default abstract and private because, by default, these are public, final and static. That is they are available at all places of the program, we can not change these values and lastly, only one instance of these variables is created, which means all classes which implement this interface have only one copy of these variables in the memory.
4. What is the use of super keyword?
ANS- The super keyword refers to superclass (parent) objects. It is used to call superclass methods, and to access the superclass constructor. The most common use of the super keyword is to eliminate the confusion between superclasses and subclasses that have methods with the same name.
5. List primitive data types available in java.
ANS- Primitive Data types in java are those data types that specify type and size of data but does not provide any additional methods, examples of primitive data types available in java include byte, short, int, char, long, float, boolean and double.
- Integer Data Types
- Floating Point Numbers
6. Define Autoboxing and Auto-Unboxing.
ANS- Autoboxing and Unboxing: The automatic conversion of primitive data types into their equivalent Wrapper type is known as boxing and the opposite operation is known as unboxing.
7. In java “String objects are immutable”. Explain.
ANS- In java, string objects are immutable. Immutable simply means unmodifiable or unchangeable. Once a string object is created its data or state can’t be changed but a new string object is created.
8. What is an Exception? List its types.
ANS- An exception (or exceptional event) is a problem that arises during the execution of a program. When an Exception occurs the normal flow of the program is disrupted and the program/Application terminates abnormally, which is not recommended, therefore, these exceptions are to be handled. Its types are:
- the checked exception
- the error and
- the runtime exception.
9. What is the purpose of the Simple Date Format class?
ANS- The purpose of the Simple Date Format class is to format and parse date and time in java. The SimpleDateFormat is a concrete class for formatting and parsing date which inherits java.text.DateFormat class.
10. Write two ways of using thread in java.
ANS- The two ways of using thread in java are given below:
- By implementing the Runnable interface.
- By extending the Thread