Interview Questions and Answers - Basic Level | Search Interview Question - javasearch.buggybread.com
Javasearch.buggybread.com

Search Interview Questions


 More than 3000 questions in repository.
 There are more than 900 unanswered questions.
Click here and help us by providing the answer.
 Have a video suggestion.
Click Correct / Improve and please let us know.
Label / Company      Label / Company / Text

   



Interview Questions and Answers - Order By Newest

   next 30
 Q41. What is the difference between inner class and sub class ?Core Java
Ans. Inner Class is a class that is nested within another class whereas sub class is a class that extends or inherit another class.

Inner class can only be accessed using reference of outer class ( Class name , if inner class is static or object reference, if inner class is non static ) whereas Sub class is accessed directly.

In terms of memory, inner class is stored just like another class having it's own body whereas sub class carries the body of parent class as well as it's own fields in memory.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     inner classes  nested classes  inner class vs sub class  nested class vs sub class      Basic


  Q42. What are the different types of inner classes ?Core Java
Ans. Simple Inner Class,
Local Inner Class,
Anonymous Inner Class,
Static Nested Inner Class.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   inner classes   classes     Asked in 6 Companies      basic        frequent

Try 1 Question(s) Test


Frequently asked in Indian Service Companies. Tech Mahindra ( Based on 3 inputs ) and Infosys ( 3 inputs )
  Q43. What is the difference between List, Set and Map ?

or

What are the different Java Collections Interfaces ?
Core Java
Ans. List - Members are stored in sequence in memory and can be accessed through index.
Set - There is no relevance of sequence and index. Sets doesn't contain duplicates whereas multiset can have duplicates.
Map - Contains Key , Value pairs.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   collections   list   set   map   list vs set vs map     Asked in 8 Companies      basic        frequent

Try 1 Question(s) Test


  Q44. Does Java support Multiple Inheritance ?Core Java
Ans. Java doesn't support multiple inheritance. Interfaces does't facilitate inheritance and hence implementation of multiple interfaces doesn't make multiple inheritance.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   oop   oop concepts   inheritence   multiple inheritence   basic interview question     Asked in 10 Companies      basic        frequent

Try 1 Question(s) Test


Frequently asked at HCL Technologies ( Based on 3 feedback )
  Q45. Difference between Checked and Unchecked exceptions ?Core Java
Ans. Checked exceptions are the exceptions for which compiler throws an errors if they are not checked whereas unchecked exceptions are caught during run time only and hence can't be checked.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   exceptions   checked exceptions   unchecked exceptions   exception handling   checked vs unchecked exceptions     Asked in 39 Companies      basic        frequent

Try 1 Question(s) Test


Very frequently asked. Favorite question in Walk in Drive of many Indian service companies.
  Q46. What is a Final Variable ?Core Java
Ans. Final variable is a variable constant that cannot be changed after initialization.

  Sample Code for final variable

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     oops   java   final   final variable   basic interview question     Asked in 12 Companies      basic        frequent

Try 1 Question(s) Test


 Q47. Difference between Abstract and Concrete Class ?Core Java
Ans. Abstract classes are only meant to be sub classed and not meant to be instantiated whereas concrete classes are meant to be instantiated.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   oops   abstract classes   Abstract vs Concrete Class     Asked in 1 Companies      basic        frequent


  Q48. Difference between Vector and ArrayList ?Core Java
Ans. Vectors are synchronized whereas Array lists are not.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   basic interview question   vector   arraylist   collections   synchronization   vector vs arraylist     Asked in 35 Companies      basic        frequent


Very Frequently asked. Usually asked along with String Class related questions.
  Q49. What is an immutable class ?Core Java
Ans. Class using which only immutable (objects that cannot be changed after initialization) objects can be created.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   oops   immutable  immutability   immutable  immutability class   string class   basic interview question     Asked in 18 Companies      Basic        frequent

Try 2 Question(s) Test


Frequently asked to fresh graduates and less experienced.
 Q50. Which of the following is tightly bound ? Inheritance or Composition ?Core Java
Ans. Inheritance.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     inheritance  object oriented programming (oops)  oops concepts   java   oops   composition  object oriented programming (oops)  oops concepts     Asked in 1 Companies      basic        frequent


Frequently asked to fresh graduates.
  Q51. Difference between Process and Thread ?Operating System
Ans. Process is a program in execution whereas thread is a separate path of execution in a program.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   threads   multi threading   operating system   process vs thread     Asked in 24 Companies      basic        frequent


 Q52. Explain Autoboxing ?Core Java
Ans. Autoboxing is the automatic conversion that the Java compiler makes between the primitive types and their corresponding object wrapper classes

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   java5   autoboxing   wrapper classes     Asked in 2 Companies      basic        frequent


Very frequently asked. Usually difference between String,StringBuffer and StringBuilder is asked in different variations.
  Q53. Difference between StringBuffer and StringBuilder ?Core Java
Ans. StringBuffer is synchronized whereas StringBuilder is not.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   string   stringbuffer   string class   stringbuilder   synchronized   basic interview question   infosys technologies     Asked in 17 Companies      basic        frequent

Try 1 Question(s) Test


  Q54. What is reflection ?
Ans. It is the process of examining / modifying the behaviour of an object at runtime.

  Sample Code for reflection

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   reflection   reflection api   ebay   mindtree     Asked in 29 Companies      basic        frequent


 Q55. Similarity and Difference between static block and static method ?Core Java
Ans. Both belong to the class as a whole and not to the individual objects. Static methods are explicitly called for execution whereas Static block gets executed when the Class gets loaded by the JVM.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   oops   static   static method   static block   difference between   similarity      basic        frequent

Try 1 Question(s) Test


Very Frequently asked.
 Q56. Explain throw, throws , try and catch in Java ?Core Java
Ans. throw is used to re throw an exception.throws is used to declare that the method throws the respective exceptions.try block is used to identify if the respective block has thrown any exception.catch is used to catch the exception that has been thrown by the respective try block.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   exception handling   throw   throws   try   catch     Asked in 5 Companies      basic        frequent


  Q57. Difference between GET and POST Requests ?Web Service
Ans. GET is supposed to get information from the server. Client sends the minimal information so that Server can respond with the response body on basis of request. For example - You want to get complete employment record for employee id 123

POST is supposed to send the information for submission. Payload or a Body is usually sent so that it can be persisted on the server. For example - Sending the complete information of an employee ( id, name , dept etc ) to the server for persisting it.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     get vs post   web service   rest     Asked in 11 Companies      basic        frequent


  Q58. Why java doesn't support multiple Inheritance ?

or

Explain Java Diamond Problem.
Core Java
Ans. class A {
void test() {
System.out.println("test() method");
}
}

class B {
void test() {
System.out.println("test() method");
}
}

Suppose if Java allows multiple inheritance like this,

class C extends A, B {
}

A and B test() methods are inheriting to C class.

So which test() method C class will take? As A & B class test() methods are different , So here we would Facing Ambiguity.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     multiple inheritance  object oriented programming (oops)  oops concepts  diamond problem     Asked in 20 Companies      basic        frequent


Usually asked to entry level software developers.
  Q59. Write a program to swap two variables without using thirdCore Java
Ans. public static void main(String[] args) {
   int num1 = 1;   
   int num2 = 2;
   num1 = num1^num2;
   num2 = num1^num2;
   num1 = num1^num2;
   System.out.print("num1 = " + num1 +", num2 = "+num2);
}

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     code  coding     Asked in 37 Companies      basic        frequent


 Q60. If an Abstract class has only abstract methods, What's the difference between such a class and an interface ?Core Java
Ans. Such a class still can have member elements which can be inherited and hence facilitate code reuse. Moreover Abstract class can have non final static elements whereas interfaces are only allowed to have static final elements.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     abstract class   interfaces     Asked in 2 Companies      Basic


  Q61. What is JSON ?Json
Ans. JSON is "JavaScript Object Notation", primarily used for client-server or server-server communication. Its a much lighter and readable alternative to XML. JSON is language independent and is easily parse-able in all programming languages.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     json   markup language   client server communication     Asked in 26 Companies      basic        frequent

Try 2 Question(s) Test


 Q62. What is an API ( Application Programming Interface ) ?
Ans. An API is a kind of technical contract which defines functionality that two parties must provide: a service provider (often called an implementation) and an application. an API simply defines services that a service provider (i.e., the implementation) makes available to applications.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     j2ee   api   java      basic        frequent


 Q63. What is URL?
Java EE
Ans. URL is Uniform Resource Locator which is representation of HTTP address.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     j2ee   http   internet   url      basic        rare


 Q64. What is HTTP ?Java EE
Ans. HTTP or Hypertext Transfer Protocol is internet protocol for tranmission of hypertext ( text with meta data ) over internet.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     j2ee   http   internet  fidelity     Asked in 2 Companies      basic        frequent


 Q65. Which access specifier can be used with Class ?Core Java
Ans. For top level class we can only use "public" and "default". We can use private with inner class.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   class   access specifier   inner classes      basic        frequent


 Q66. Different ways of implementing Threads in Java ?Core Java
Ans. Threads in Java can be implement either by Extending Thread class or implementing runnable interface.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   threads   multi threading     Asked in 1 Companies      basic        frequent


 Q67. What is a Final Method ?Core Java
Ans. A Method that cannot be overriden in the sub class.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   oops   java keywords   final   final method   overriding   basic interview question      basic        frequent

Try 1 Question(s) Test


Very Frequently asked.Favorite question in Walk in drive for many Indian service companies.
 Q68. What is a Final Class ?
Ans. A Class that cannot be sub classed.

  Sample Code for final class

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   oops   final   final class   java keyword   basic interview question     Asked in 3 Companies      basic        frequent


Very frequently asked. Usually asked with questions related to String. Frequently asked at CTS / Cognizant
  Q69. What is an Immutable Object ?Core Java
Ans. Object that can't be changed after instantiation.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   oops   immutable  immutability     Asked in 27 Companies      basic        frequent

Try 2 Question(s) Test


 Q70. Name few Java Exceptions ?Core Java
Ans. IndexOutofBoundException ,
NoClassDefFoundException ,
OutOfMemoryException ,
IllegalArgumentException,
NullPointerException,
IllegalStateException

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   oops   exceptions   basic interview question      basic        frequent


previous 30   next 30

Help us and Others Improve. Please let us know the questions asked in any of your previous interview.

Any input from you will be highly appreciated and It will unlock the application for 10 more requests.

Company Name:
Questions Asked: