Interview Questions for java
Interview Questions for Java
Question : 1 What do you know about Java?
Question : 2 What are the supported platform by Java Programming Language?
Question : 3 List any five features of Java?
Question : 4 Why is Java Architectural Neutral?
Question : 5 How Java enabled High Performance?
Question : 6 Why Java is considered dynamic?
Question : 7 What is Java Virtual Machine and how it is considered in context of Java's platform independent feature?
Question : 8 List two Java IDE's?
Question : 9 List some Java keywords(unlike C, C++ keywords)?
Question : 10 What do you mean by Object?
Question : 11 Define class?
Question : 12 What kind of variables a class can consist of?
Question : 13 What is a Local Variable
Question : 14 What is a Instance Variable
Question : 15 What is a Class Variable
Question : 16 What is Singleton class?
Question : 17 What do you mean by Constructor?
Question : 18 List the three steps for creating an Object for a class?
Question : 19 What is the default value of byte datatype in Java?
Question : 20 What is the default value of float and double datatype in Java?
Question : 21 When a byte datatype is used?
Question : 22 What is a static variable?
Question : 23 What do you mean by Access Modifier?
Question : 24 What is protected access modifier?
Question : 25 What do you mean by synchronized Non Access Modifier?
Question : 26 : According to Java Operator precedence, which operator is considered to be with highest precedence?
Question : 27 Variables used in a switch statement can be used with which datatypes?
Question : 28 When parseInt() method can be used?
Question : 29 Why is String class considered immutable?
Question : 30 Why is StringBuffer called mutable?
Question : 31 What is the difference between StringBuffer and StringBuilder class?
Question : 32 Which package is used for pattern matching with regular expressions?
Question : 33 java.util.regex consists of which classes?
Question : 34 What is finalize() method?
Question : 35 What is an Exception?
Question : 36 What do you mean by Checked Exceptions?
Question : 37 What do you mean by Checked Exceptions?
Question : 38 Explain Runtime Exceptions?
Question : 39 Which are the two subclasses under Exception class?
Question : 40 When throws keyword is used?
Question : 41 When throw keyword is used?
Question : 42 How finally used under Exception Handling?
Question : 43 What things should be kept in mind while creating your own exceptions in Java?
Question : 44 Define Inheritance?
Question : 45 When super keyword is used?
Question : 46 What is Polymorphism?
Question : 47 What is Abstraction?
Question : 48 What is Abstract class
Question : 49 When Abstract methods are used?
Question : 50 What is Encapsulation?
Question : 51 What is the primary benefit of Encapsulation?
Question : 52 What is an Interface?
Question : 53 Give some features of Interface?
Question : 54 Define Packages in Java?
Question : 55 Why Packages are used?
Question : 56 What do you mean by Multithreaded program?
Question : 57 What are the two ways in which Thread can be created?
Question : 58 What is an applet?
Question : 59 An applet extend which class?
Question : 60 Explain garbage collection in Java?
Question : 61 Define immutable object?
Question : 62 Explain the usage of this() with constructors?
Question : 63 Explain Set Interface?
Question : 64 Explain TreeSet?
Question : 65 What is Comparable Interface?
Question : 66 Difference between throw and throws?
Question : 67 Explain the following line used under Java Program:
public static void main (String args[ ])
Question : 68 Define JRE i.e. Java Runtime Environment?
Question : 69 What is JAR file?
Question : 70 What is a WAR file?
Question : 71 Define JIT compiler?
Question : 72 What is the difference between object oriented programming language and object based programming language?
Question : 73 What is the purpose of default constructor?
Question : 74 Can a constructor be made final?
Question : 75 What is static block?
Question : 76 Define composition?
Question : 77 What is function overloading?
Question : 78 What is function overriding?
Question : 79 Difference between Overloading and Overriding?
Question : 80 What is final class?
Question : 81 What is NullPointerException?
Question : 82 What are the ways in which a thread can enter the waiting state?
Question : 83 How does multi-threading take place on a computer with a single CPU?
Question : 84 What invokes a thread's run() method?
Question : 85 Does it matter in what order catch statements for FileNotFoundException and IOException are written?
Question : 86 What is the difference between yielding and sleeping?
Question : 87 Why Vector class is used?
Question : 88 How many bits are used to represent Unicode, ASCII, UTF-16, and UTF-8 characters?
Question : 89 What are Wrapper classes?
Question : 90 What is the difference between a Window and a Frame?
Question : 91 Which package has light weight components?
Question : 92 What is the difference between the paint() and repaint() methods?
Question : 93 What is the purpose of File class?
Question : 94 What is the difference between the Reader/Writer class hierarchy and the InputStream/OutputStream class hierarchy?
Question : 95 Which class should you use to obtain design information about an object?
Question : 96 What is the difference between static and non-static variables?
Question : 97 What is Serialization and deserialization?
Question : 98 What are use cases?
Question : 99 Explain the use of sublass in a Java program?
Question : 100 How to add menushortcut to menu item?
Question : 101 Can you write a Java class that could be used both as an applet as well as an application?
Question : 102 What is the difference between Swing and AWT components?
Question : 103 What's the difference between constructors and other methods?
Question : 104 Is there any limitation of using Inheritance?
Question : 105 When is the ArrayStoreException thrown?
Question : 106 Can you call one constructor from another if a class has multiple constructors?
Question : 107 the difference between the methods sleep() and wait()?
Question : 108 When ArithmeticException is thrown?
Question : 109 What is a transient variable?
Question : 110 What is synchronization?
Question : 111 What is the Collections API?
Question : 112 Does garbage collection guarantee that a program will not run out of memory?
Question : 113 The immediate superclass of the Applet class?
Question : 114 Which Java operator is right associative?
Question : 115 What is the difference between a break statement and a continue statement?
Question : 116 If a variable is declared as private, where may the variable be accessed?
Question : 117 What is the purpose of the System class?
Question : 118 List primitive Java types?
Question : 119 What is the relationship between clipping and repainting under AWT?
Question : 120 Which class is the immediate superclass of the Container class?
Question : 121 What class of exceptions are generated by the Java run-time system?
Question : 122 Under what conditions is an object's finalize() method invoked by the garbage collector?
Question : 123 How can a dead thread be restarted?
Question : 124 Which arithmetic operations can result in the throwing of an ArithmeticException?
Question : 125 Variable of the boolean type is automatically initialized as?
Question : 126 Can try statements be nested?
Question : 127 What are ClassLoaders?
Question : 128 What is the difference between an Interface and an Abstract class?
Question : 129 What will happen if static modifier is removed from the signature of the main method?
Question : 130 What is the default value of an object reference declared as an instance variable?
Question : 131 Can a top level class be private or protected?
Question : 132 Why do we need wrapper classes?
Question : 133 What is the difference between error and an exception?
Question : 134 Is it necessary that each try block must be followed by a catch block?
Question : 135 When a thread is created and started, what is its initial state?
Question : 136 What is the Locale class?
Question : 137 What are synchronized methods and synchronized statements?
Question : 138 What is runtime polymorphism or dynamic method dispatch?
Question : 139 What is Dynamic Binding(late binding)?
Question : 140 Can constructor be inherited?
Question : 141 What are the advantages of ArrayList over arrays?
Question : 142 Why deletion in LinkedList is fast than ArrayList?
Question : 143 How do you decide when to use ArrayList and LinkedList?
Question : 144 What is a Values Collection View ?
Question : 145 What is dot operator?
Question : 146 Where and how can you use a private constructor?
Question : 147 What is type casting?
Question : 148 Describe life cycle of thread?
Question : 149 What is the difference between the >> and >>> operators?
Question : 150 Which method of the Component class is used to set the position and size of a component?
Question : 151 What is the range of the short type?
Question : 152 What is the immediate superclass of Menu?
Question : 153 Does Java allow Default Arguments?
Question : 154 Which number is denoted by leading zero in java?
Question : 155 Which number is denoted by leading 0x or 0X in java?
Question : 156 Break statement can be used as labels in Java?
Question : 157 Where import statement is used in a Java program?
Question : 158 Explain suspend() method under Thread class>
Question : 159 Explain isAlive() method under Thread class?
Question : 160 What is currentThread()?
Question : 161 Explain main thread under Thread class execution?
Question : 162 Life cycle of an applet includes which steps?
Question : 163 Why is the role of init() method under applets?
Question : 164 Which method is called by Applet class to load an image?
Question : 165 Define code as an attribute of Applet?
Question : 166 Define canvas?
Question : 167 Define Network Programming?
Question : 168 What is a Socket?
Question : 169 Advantages of Java Sockets?
Question : 170 Disadvantages of Java Sockets?
Question : 171 Which class is used by server applications to obtain a port and listen for client requests?
Question : 172 Which class represents the socket that both the client and server use to communicate with each other?
Question : 173 Why Generics are used in Java?
Question : 174 What environment variables do I need to set on my machine in order to be able to run Java programs?
Question : 175 Is there any need to import java.lang package?
Question : 176 What is Nested top-level class?
Question : 177 What is Externalizable interface?
Question : 178 If System.exit (0); is written at the end of the try block, will the finally block still execute?
Question : 179 What is daemon thread?
Question : 180 Which method is used to create the daemon thread?
Question : 181 Which method must be implemented by all threads?
Question : 182 What is the GregorianCalendar class?
Question : 183 What is the SimpleTimeZone class?
Question : 184 What is the difference between the size and capacity of a Vector?
Question : 185 Can a vector contain heterogenous objects?
Question : 186 What is an enumeration?
Question : 187 What is difference between Path and Classpath?
Question : 188 Can a class declared as private be accessed outside it's package?
Question : 189 What are the restriction imposed on a static method or a static block of code?
Question : 190 Can an Interface extend another Interface?
Question : 191 Which object oriented Concept is achieved by using overloading and overriding?
Question : 192 What is an object's lock and which object's have locks?
Question : 193 What is Downcasting?
Question : 194 What are order of precedence and associativity and how are they used?
Question : 195 If a method is declared as protected, where may the method be accessed?
Question : 196 What is the difference between inner class and nested class?
Question : 197 What restrictions are placed on method overriding?
Question : 198 What is constructor chaining and how is it achieved in Java?
Question : 199 Can a double value be cast to a byte?
Question : 200 How does a try statement determine which catch clause should be used to handle an exception?
Question : 201 What will be the default values of all the elements of an array defined as an instance variable?
Question : 202 What is the difference between an Interface and an Abstract class?
Question : 203 What is the purpose of garbage collection in Java, and when is it used?
Question : 204 Describe synchronization in respect to multithreading.
Question : 205 Explain different way of using thread?
Question : 206 What is JDK?
Question : 207 What is the significance of the .class file?
Question : 208 How many classes can be declared in a Java program?
Question : 209 How is the main() method invoked?
Question : 210 How many classes can contain the main() method in a Java program?
Question : 211 What is the out object?
Question : 212 Why do you need to put an ‘f'’ literal after a floating point constant?
Question : 213 Does Java support multiple inheritance?
Question : 214 Can I instantiate an interface?
Question : 215 What is the return value of the getContentPane()method?
Question : 216 What is the difference between a frame and a dialog box?
Question : 217 Can you write a java code that works both as an applet and an application?
Question : 218 Can I put more than one applet on a Web page?
Question : 219 How do I determine the width and the height of my applet?
Question : 220 Should applets have constructors?
Question : 221 Why do I get RuntimeAccessPermission exception when I am trying to execute a Java
program which will load an image?
Question : 222 Why does my program not load the image even when the gif files are present in the specified directory?
Question : 223 When do I need to flush an output stream?
Question : 224 What is the advantage of Buffered streams over normal streams?
Question : 225 How do I read a line of input at a time?
Question : 226 What is meant by Serialization?
Question : 227 Give two examples of real world objects. Also specify their characteristics and behaviour.
Question : 228 What do you understand by state of an object? Explain with an example.
Question : 229 How are objects implemented in Software?
Question : 230 What is abstraction? How is encapsulation related to it?
Question : 231 Define Encapsulation.
Question : 232 Explain the term object using an example.
Question : 233 What is Object Oriented Programming?
Question : 234 Give a real life example of Polymorphism.
Question : 235 What is Java API?
Question : 236 Define the term Byte Code.
Question : 237 What is JVM? Explain its relationship with byte code.
Question : 238 What is a platform? How does it differ from a Java platform?
Question : 239 State the difference between Applet and Application.
Question : 240 What makes Java suitable to create secured applications?
Question : 241 What does the Robust feature in Java mean?
Question : 242 What is Multithreading in Java?
Question : 243 What makes Java Architecture Neutral?
Question : 244 What is WORA?
Question : 245 Explain the statement “Byte code is the object code for the JVMâ€
Question : 246 State two differences between fundamental and user-defined data type.
Question : 247 State two differences between a class and an object.
Question : 248 Why is a class called a user defined data type?
Question : 249 What is an access specifier? Which two access specifier is used in a class declaration?
Question : 250 Why is a class called an object factory?
Question : 251 State two rules you should follow for naming a class
Question : 252 What two conventions you should follow naming a class?
Question : 253 State two conventions you should follow while naming a class.
Question : 254 How are Decimal, Octal and Hexadecimal integer literals represented in Java?
Question : 255 What are separators?
Question : 256 What is Type Conversion? Name the two type conversions in Java.
Question : 257 What is an operator? How is the classification of operators based upon?
Question : 258 What is an expression?
Question : 259 What is an accumulator?
Question : 260 What is a bug? What is debugging?
Question : 261 What are the different type of errors that may occur in a Java program?
Question : 262 What are syntax errors? Give two examples.
Question : 263 What are run-time errors? Give two examples.
Question : 264 What are comments? Name the different types of comments used in Java.
Question : 265 Give two examples of real world objects. Also specify their characteristics and behaviour.
Give two examples of real world objects. Also specify their characteristics and behaviour.
Question : 266 What is the difference between break and continue statements when they occur in a loop?
What is the difference between break and continue statements when they occur in a loop?
Question : 267 State one similarity and one difference between while and for loop.
State one similarity and one difference between while and for loop.
Question : 268 Name two jump statements and their use
Name two jump statements and their use