51. What Is An Interface?
Answer: An interface is a collection of abstract methods. A class implements an interface, thereby
inheriting the abstract methods of the interface.
52. Give Some Features Of Interface?
Answer: Some features of interfaces are:
53. Define Packages In Java?
Answer: A Package can be defined as a grouping of related types, classes, interfaces, enumerations and annotations providing access protection and name space management.
54. Why Packages Are Used?
Answer: Packages are used in Java in-order to prevent naming conflicts, to control access, to make searching/locating and usage of classes, interfaces, enumerations and annotations, etc., easier.
55. What Do You Mean By Multithreaded Program?
Answer: A multithreaded program contains two or more parts that can run concurrently. Each part of such a program is called a thread, and each thread defines a separate path of execution.
56. What Are The Two Ways In Which Thread Can Be Created?
Answer: Thread can be created by: implementing Runnable interface, extending the Thread class.
57. What As An Applet? An Applet Extends Which Class?
Answer: An applet is a Java program that runs in a Web browser. An applet can be a fully functional Java application because it has the entire Java API at its disposal.
An applet extends java.applet.Applet class.
58. Explain Garbage Collection In Java?
Answer: It uses garbage collection to free the memory. By cleaning those objects that is no longer
referenced by any of the program.
59. Define Immutable Object?
Answer: An immutable object can’t be changed once it is created.
60. Explain The Usage Of This With Constructors?
Answer: It is used with variables or methods and used to call constructor of same class.
61. Explain Set Interface?
Answer: It is a collection of element which cannot contain duplicate elements. The Set interface contains only methods inherited from Collection and adds the restriction that duplicate elements are prohibited.
62. Explain TreeSet?
Answer: It is a Set implemented when we want elements in a sorted order.
63. What Is Comparable Interface?
Answer: It is used to sort collections and arrays of objects using the collections.sort and java.utils. The objects of the class implementing the Comparable interface can be ordered.
64. Difference Between Throw & Throws?
Answer: Throw is used to trigger an exception where as throws is used in declaration of exception.
Without throws, Checked exception cannot be handled whereas checked exception can be propagated with throws.
65. Explain The Following Line Used Under Java Program − public static void main Stringargs[]
Answer: The following shows the explanation individually:
66. Define JRE i.e. Java Runtime Environment?
Answer: Java Runtime Environment is an implementation of the Java Virtual Machine which executes Java programs. It provides the minimum requirements for executing a Java application;
67. What Is JAR File?
Answer: JAR files is Java Archive files and it aggregates many files into one. It holds Java classes in a library. JAR files are built on ZIP file format and have .jar file extension.
68. What Is A WAR File?
Answer: This is Web Archive File and used to store XML, java classes, and JavaServer pages. which is used to distribute a collection of JavaServer Pages, Java Servlets, Java classes, XML files, static Web pages etc.
69. Define JIT Compiler?
Answer: It improves the runtime performance of computer programs based on bytecode.
70. What Is The Difference Between Object Oriented Programming Language & Object Based Programming Language?
Answer: Object based programming languages follow all the features of OOPs except Inheritance. JavaScript is an example of object based programming languages.
71. What Is The Purpose Of Default Constructor?
Answer: The java compiler creates a default constructor only if there is no constructor in the class.
72. Can A Constructor Be Made Final?
Answer: No, this is not possible.
73. What Is Static Block?
Answer: It is used to initialize the static data member, It is executed before main method at the time of classloading.
74. Define Composition?
Answer: Holding the reference of the other class within some other class is known as composition.
75. What Is Function Overloading?
Answer: If a class has multiple functions by same name but different parameters, it is known as Method Overloading.
Check Out Other Questions As Well: -
76. What Is Function Overriding?
77. Difference Between Overloading & Overriding?
78. What Is Final Class?
79. What Is NullPointerException?
80. What Are The Ways In Which A Thread Can Enter The Waiting State?
81. How Does Multithreading Take Place On A Computer With A Single CPU?
82. What Invokes A Thread's Run Method?
83. Does It Matter In What Order Catch Statements For FileNotFoundException & IOException Are Written?
84. What Is The Difference Between Yielding & Sleeping?
85. Why Vector Class Is Used?
86. How Many Bits Are Used To Represent Unicode, ASCII, UTF-16, & UTF-8 Characters?
87. What Are Wrapper Classes?
88. What Is The Difference Between A Window & A Frame?
89. Which Package Has Light Weight Components?
90. What Is The Difference Between The paint & repaint Methods?
91. What Is The Purpose Of File Class?
92. What Is The Difference Between The Reader/Writer Class Hierarchy & The InputStream/OutputStream Class Hierarchy?
93. Which Class Should You Use To Obtain Design Information About An Object?
94. What Is The Difference Between Static & Nonstatic Variables?
95. What Is Serialization & Deserialization?
96. What Are Use Cases?
97. Explain The Use Of subclass In A Java Program?
98. How To Add Menu Shortcut To Menu Item?
99. Can You Write A Java Class That Could Be Used Both As An Applet As Well As An Application?
100. What Is The Difference Between Swing & AWT Components?
...Return To Java FAQ's Section
Answer: An interface is a collection of abstract methods. A class implements an interface, thereby
inheriting the abstract methods of the interface.
52. Give Some Features Of Interface?
Answer: Some features of interfaces are:
- Interface cannot be instantiated
- An interface does not contain any constructors.
- All of the methods in an interface are abstract.
53. Define Packages In Java?
Answer: A Package can be defined as a grouping of related types, classes, interfaces, enumerations and annotations providing access protection and name space management.
54. Why Packages Are Used?
Answer: Packages are used in Java in-order to prevent naming conflicts, to control access, to make searching/locating and usage of classes, interfaces, enumerations and annotations, etc., easier.
55. What Do You Mean By Multithreaded Program?
Answer: A multithreaded program contains two or more parts that can run concurrently. Each part of such a program is called a thread, and each thread defines a separate path of execution.
56. What Are The Two Ways In Which Thread Can Be Created?
Answer: Thread can be created by: implementing Runnable interface, extending the Thread class.
57. What As An Applet? An Applet Extends Which Class?
Answer: An applet is a Java program that runs in a Web browser. An applet can be a fully functional Java application because it has the entire Java API at its disposal.
An applet extends java.applet.Applet class.
58. Explain Garbage Collection In Java?
Answer: It uses garbage collection to free the memory. By cleaning those objects that is no longer
referenced by any of the program.
59. Define Immutable Object?
Answer: An immutable object can’t be changed once it is created.
60. Explain The Usage Of This With Constructors?
Answer: It is used with variables or methods and used to call constructor of same class.
61. Explain Set Interface?
Answer: It is a collection of element which cannot contain duplicate elements. The Set interface contains only methods inherited from Collection and adds the restriction that duplicate elements are prohibited.
62. Explain TreeSet?
Answer: It is a Set implemented when we want elements in a sorted order.
63. What Is Comparable Interface?
Answer: It is used to sort collections and arrays of objects using the collections.sort and java.utils. The objects of the class implementing the Comparable interface can be ordered.
64. Difference Between Throw & Throws?
Answer: Throw is used to trigger an exception where as throws is used in declaration of exception.
Without throws, Checked exception cannot be handled whereas checked exception can be propagated with throws.
65. Explain The Following Line Used Under Java Program − public static void main Stringargs[]
Answer: The following shows the explanation individually:
- public − it is the access specifier.
- static − it allows main to be called without instantiating a particular instance of a class.
- void − it affirms the compiler that no value is returned by main.
- main − this method is called at the beginning of a Java program.
- String args[ ] − args parameter is an instance array of class String.
66. Define JRE i.e. Java Runtime Environment?
Answer: Java Runtime Environment is an implementation of the Java Virtual Machine which executes Java programs. It provides the minimum requirements for executing a Java application;
67. What Is JAR File?
Answer: JAR files is Java Archive files and it aggregates many files into one. It holds Java classes in a library. JAR files are built on ZIP file format and have .jar file extension.
68. What Is A WAR File?
Answer: This is Web Archive File and used to store XML, java classes, and JavaServer pages. which is used to distribute a collection of JavaServer Pages, Java Servlets, Java classes, XML files, static Web pages etc.
69. Define JIT Compiler?
Answer: It improves the runtime performance of computer programs based on bytecode.
70. What Is The Difference Between Object Oriented Programming Language & Object Based Programming Language?
Answer: Object based programming languages follow all the features of OOPs except Inheritance. JavaScript is an example of object based programming languages.
71. What Is The Purpose Of Default Constructor?
Answer: The java compiler creates a default constructor only if there is no constructor in the class.
72. Can A Constructor Be Made Final?
Answer: No, this is not possible.
73. What Is Static Block?
Answer: It is used to initialize the static data member, It is executed before main method at the time of classloading.
74. Define Composition?
Answer: Holding the reference of the other class within some other class is known as composition.
75. What Is Function Overloading?
Answer: If a class has multiple functions by same name but different parameters, it is known as Method Overloading.
Check Out Other Questions As Well: -
76. What Is Function Overriding?
77. Difference Between Overloading & Overriding?
78. What Is Final Class?
79. What Is NullPointerException?
80. What Are The Ways In Which A Thread Can Enter The Waiting State?
81. How Does Multithreading Take Place On A Computer With A Single CPU?
82. What Invokes A Thread's Run Method?
83. Does It Matter In What Order Catch Statements For FileNotFoundException & IOException Are Written?
84. What Is The Difference Between Yielding & Sleeping?
85. Why Vector Class Is Used?
86. How Many Bits Are Used To Represent Unicode, ASCII, UTF-16, & UTF-8 Characters?
87. What Are Wrapper Classes?
88. What Is The Difference Between A Window & A Frame?
89. Which Package Has Light Weight Components?
90. What Is The Difference Between The paint & repaint Methods?
91. What Is The Purpose Of File Class?
92. What Is The Difference Between The Reader/Writer Class Hierarchy & The InputStream/OutputStream Class Hierarchy?
93. Which Class Should You Use To Obtain Design Information About An Object?
94. What Is The Difference Between Static & Nonstatic Variables?
95. What Is Serialization & Deserialization?
96. What Are Use Cases?
97. Explain The Use Of subclass In A Java Program?
98. How To Add Menu Shortcut To Menu Item?
99. Can You Write A Java Class That Could Be Used Both As An Applet As Well As An Application?
100. What Is The Difference Between Swing & AWT Components?
...Return To Java FAQ's Section
Comments
Post a Comment
Please share your opinions and suggestions or your experience in the comments section. This way we can all help each other...
Experienced guys can share their resumes at admin@interview-made-easy.com