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. |
|
| ||||
Interview Questions and Answers - Order By Newest | ||||
Frequently asked. | ||||
| ||||
Ans. A finally block of code always executes, whether or not an exception has occurred.The only time finally won't be called is if you call System.exit() or if the JVM crashes first. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  finally  exception handling  exceptions Asked in 4 Companies basic   frequent | ||||
| ||||
Ans. System is a class within java.lang package that contains several useful class fields and methods. It cannot be instantiated and hence can use only statically.even in this case this has been used statically i.e with class name itself and without creating an instance. out is the static reference of Printstream declared as following in the System Class - public final static PrintStream out = null; println is the method of PrintStream class. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  System class  Streams  Input Output  println Asked in 1 Companies basic   frequent | ||||
| ||||
Ans. No | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  operator overloading Asked in 1 Companies basic | ||||
| ||||
Ans. static keyword is used to specify that the respective programming construct ( method , variable ) belongs to the class and not to its instance and is supposed to be shared by all instances of the class. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  static keyword Asked in 1 Companies basic   frequent | ||||
| ||||
This question was recently asked at 'HeadStrong,ServiceNow'.This question is still unanswered. Can you please provide an answer. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  Search Algorithm  Sorting Algorithm Asked in 2 Companies basic   frequent | ||||
| ||||
Ans. It's an object that can intercept http request and response and hence we can take appropriate action on those requests. There are different types of filters based on Specifications like Authentication Logging Encryption Tokenizing etc | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  servlets  servlet filters Asked in 3 Companies basic   frequent | ||||
| ||||
Ans. Authentication is the process of verifying the identity and credentials of the user to authenticate him into the system. whereas Authorization is the process by which access to a segment , method or resource is determined. Authorization is usually a step next to authentication. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  authentication  authorization  authentication vs authorization Asked in 9 Companies basic   frequent | ||||
| ||||
Ans. It gets the default access i.e package protected. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  access specifiers  default Access specifier Basic | ||||
| ||||
Ans. Java identifies the method to be called at runtime by the object that is being referenced. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  polymorphism  object oriented programming (oops)  oops concepts  overloading  overriding basic | ||||
| ||||
Ans. Encrypted User Name / Password Encrypted Password within Cookie Encrypted Tokens IP Client Certificates Oauth | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  authentication  security  web service Asked in 12 Companies basic   frequent | ||||
| ||||
Ans. File folder = new File(path); if(!folder.exists()){ try { folder.mkdir(); } catch (Exception e) {} } | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  code  coding  file handling basic | ||||
| ||||
Ans. Both Arrays and ArrayLists are used to store elements. Elements can be either primitives or objects in case of Arrays, but only objects can be stored in Arraylist. Array is a fixed length data structure while arraylist is variable length collection class. Once created, you cannot change the size of the arrays, but arraylists can dynamically resize itself when needed.Another notable difference between Arrays and Arrayslist is that arary is part of core java programming and array list is part of collection classes | ||||
Sample Code for arrays arraylist | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  array  arraylist  array vs arraylist Asked in 7 Companies basic   frequent | ||||
| ||||
Ans. A cookie is a small piece of text stored on a user's computer by the browser for a specific domain. Commonly used for authentication, storing site preferences, and server session identification. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  cookie   javascript   web application   session management   browser   j2ee Asked in 16 Companies basic   frequent | ||||
| ||||
Ans. Though Static methods cannot access the instance variables directly, They can access them using instance handler. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  static   static method   java   oop   variables Asked in 1 Companies basic   frequent | ||||
Very frequently asked. Usually asked in this format or as difference with interfaces / concrete classes. | ||||
| ||||
Ans. Abstract class is the class that is not supposed to be instantiated. The purpose of the class to only have extension to the derived class. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  abstract class Asked in 6 Companies basic   frequent | ||||
| ||||
Ans. Java.util.Map | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   collections   hashtable   map basic   rare | ||||
Frequently asked. | ||||
| ||||
Ans. Iterator is an interface that provides methods to iterate over any Collection. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   collections   iterator Asked in 11 Companies basic   frequent | ||||
| ||||
Ans. java.util.map | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   collections   map basic   frequent | ||||
| ||||
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  java   oops   inheritence   multiple inheritence Asked in 1 Companies basic   frequent | ||||
Frequently asked to fresh graduates. | ||||
| ||||
Ans. When a object invokes yield() it returns to ready state. But when an object invokes sleep() method enters to not ready state. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   threads   multi threading   yield   sleep   scheduling   operating system Asked in 4 Companies basic   frequent | ||||
Usually asked only to fresh graduates. | ||||
| ||||
Ans. Ready state. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  operating system   threads   multi threading   java   thread states Asked in 1 Companies basic   frequent | ||||
| ||||
Ans. Overridden methods must have the same name, argument list, and return type. The overriding method may not limit the access of the method it overrides. The overriding method may not throw any exceptions that may not be thrown by the overridden method. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   oops   overriding basic   frequent | ||||
Try 2 Question(s) Test | ||||
| ||||
Ans. When an exception is thrown within the body of a try statement, the catch clauses of the try statement are examined in the order in which they appear. The first catch clause that is capable of handling the exception is executed. The remaining catch clauses are ignored. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   exceptions   exception handling   try   catch basic   frequent | ||||
| ||||
Ans. A static initialization block is a normal block of code enclosed in braces, { }, and preceded by the static keyword. Here is an example: static { // whatever code is needed for initialization goes here } A class can have any number of static initialization blocks, and they can appear anywhere in the class body. The runtime system guarantees that static initialization blocks are called in the order that they appear in the source code. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   oops   static   static block Asked in 16 Companies basic   frequent | ||||
| ||||
Ans. Annotations, a form of metadata, provide data about a program that is not part of the program itself. Annotations have no direct effect on the operation of the code they annotate. Annotations have a number of uses, among them: • Information for the compiler — Annotations can be used by the compiler to detect errors or suppress warnings. • Compile-time and deployment-time processing — Software tools can process annotation information to generate code, XML files, and so forth. • Runtime processing — Some annotations are available to be examined at runtime. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   annotations basic   frequent | ||||
| ||||
Ans. finalize() method is called just before an object is destroyed. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   oops   finalize   garbage collection   basic interview question Asked in 1 Companies basic   frequent | ||||
Try 1 Question(s) Test | ||||
Recently asked in Infoview Technologies. | ||||
| ||||
Ans. The no argument constructor provided by Java Compiler if no constructor is specified. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   oops   constructor   default constructor Asked in 1 Companies Basic   frequent | ||||
Try 2 Question(s) Test | ||||
| ||||
Ans. Yes. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   oops   constructors   overloading   yes-no   basic interview question | ||||
| ||||
Ans. We can't create the objects directly by invoking new operator. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   oops   constructor   access specifier   private Asked in 1 Companies basic | ||||
Try 2 Question(s) Test | ||||
| ||||
Ans. suspend() method is used to suspend the execution of a thread for a period of time. We can then restart the thread by using resume() method. | ||||
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   synchronization basic   rare | ||||