Interview Questions and Answers - Order By Rating Q31. Can I hit the Rest Post Request through a browser address bar if it's not expecting any payload / body ? Rest
Ans. No, even if there is no payload, you can't hit the POST request by typing it into browser address bar. You will need a client that can make a POST Request. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  Post Request   Rest  Calling Rest service through browser   rare Q32. Is it Necessary to send a POST request with the Payload or a body ? Web Service
Ans. No, we can also send an empty body with the POST Request. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  Get Request   Rest   rare Q33. What is "Instance Initializer block" ?
Ans. Instance Initializer block is used to initialize the instance data member. It run each time when object of the class is created. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  Instance Initializer block   rare Q34. What is servlet Chaining ? Java EE
Ans. Multiple servlets serving the request in chain. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   web application   servlets Asked in 1 Companies   rare Q35. What are the Wrapper classes available for primitive types ? Core Java
Ans. boolean - java.lang.Boolean
byte - java.lang.Byte
char - java.lang.Character
double - java.lang.Double
float - java.lang.Float
int - java.lang.Integer
long - java.lang.Long
short - java.lang.Short
void - java.lang.Void Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   java5   data types   wrapper classes   adapter design pattern   rare Q36. What are concepts introduced with Java 5 ? Core Java
Ans. Generics , Enums , Autoboxing , Annotations and Static Import. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   java5   generics   enum   autoboxing   annotations   static import   rare Try 1 Question(s) Test Q37. Does Constructor creates the object ? Core Java
Ans. New operator in Java creates objects. Constructor is the later step in object creation. Constructor's job is to initialize the members after the object has reserved memory for itself. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   constructor   object creation intermediate   rare Q38. Which String class does not override the equals() and hashCode() methods, inheriting them directly from class Object? Core Java
Ans. java.lang.StringBuffer. Sample Code for StringBuffer Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   object class   stringbuffer expert   rare Q39. Which interface does java.util.Hashtable implement? Core Java
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 Q40. Can we serialize static variables ? Core Java
Ans. No. Only Object and its members are serialized. Static variables are shared variables and doesn't correspond to a specific object. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  serialization   java   oops   static   static variables Asked in 1 Companies intermediate   rare Try 2 Question(s) Test Q41. Difference between long.Class and Long.TYPE ?
Ans. They both represent the long primitive type. They are exactly the same. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   data types   long.Class   long.TYPE   advanced expert   rare Q42. What are the common uses of "this" keyword in java ? Core Java
Ans. "this" keyword is a reference to the current object and can be used for following -
1. Passing itself to another method.
2. Referring to the instance variable when local variable has the same name.
3. Calling another constructor in constructor chaining. Sample Code for this keyword Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   this   object reference   constructor chaining intermediate   rare Try 3 Question(s) Test Q43. Can constructors be synchronized in Java ? Core Java
Ans. No. Java doesn't allow multi thread access to object constructors so synchronization is not even needed. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  synchronization   synchronize   constructor   java   multithreading   yes-no   advanced Asked in 1 Companies expert   rare Q44. What are transient variables in java? Core Java
Ans. Transient variables are variable that cannot be serialized. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   serialization   transient Asked in 15 Companies intermediate   rare Usually asked only to fresh graduates. Q45. What is the difference between time slicing and preemptive scheduling ? Operating System
Ans. In preemptive scheduling, highest priority task continues execution till it enters a not running state or a higher priority task comes into existence. In time slicing, the task continues its execution for a predefined period of time and reenters the pool of ready tasks. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  operating system   scheduling   threads   multi threading   rare Q46. Which memory segment loads the java code ? Core Java
Ans. Code segment. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  memory   java   memory management   code segment  code segment memory expert   rare Q47. Can a lock be acquired on a class ?
Ans. Yes, a lock can be acquired on a class. This lock is acquired on the class's Class object. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   scheduling   threads   multi threading expert   rare Q48. Are constructors inherited? Can a subclass call the parent's class constructor? When? Core Java
Ans. You cannot inherit a constructor. That is, you cannot create a instance of a subclass using a constructor of one of it's superclasses. One of the main reasons is because you probably don't want to override the superclasses constructor, which would be possible if they were inherited. By giving the developer the ability to override a superclasses constructor you would erode the encapsulation abilities of the language. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   oops   constructor   inheritence Asked in 1 Companies expert   rare Try 1 Question(s) Test Q49. What is the role of JSON.stringify ? Json
Ans. JSON.stringify() turns an object into a JSON text and stores that JSON text in a string.
So If we stringfy above notation , it will become
{"name":"xyz","gender":"male";"age":30} Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  json   JSON.stringify intermediate   rare 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 Q51. Can I import same package/class twice? Will the JVM load the package twice at runtime? Core Java
Ans. One can import the same package or same class multiple times. Neither compiler nor JVM complains wil complain about it. And the JVM will internally load the class only once no matter how many times you import the same class. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   import   jvm   advanced Asked in 1 Companies intermediate   rare Q52. Difference between boolean and Boolean ? Core Java
Ans. boolean is a primitive type whereas Boolean is a class. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   oops   wrapper classes   boolean vs Boolean basic   rare Q53. Will Compiler creates a default no argument constructor if we specify only multi argument constructor ?
Ans. No, Compiler will create default constructor only if we don't specify any constructor. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   oops   constructor   default constructor   yes-no expert   rare Try 1 Question(s) Test Q54. Can we use both "this()" and "super()" in a constructor ? Core Java
Ans. No, because both this and super should be the first statement. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   oops  this   super   constructor Asked in 1 Companies intermediate   rare Try 2 Question(s) Test Q55. Can we declare an abstract method private ?
Ans. No Abstract methods can only be declared protected or public. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   abstract   oops   access specifier   private   yes-no intermediate   rare Q56. What is suspend() method used for ?
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 Usually asked only to fresh graduates. Q57. Difference between suspend() and stop() ?
Ans. Suspend method is used to suspend thread which can be restarted by using resume() method. stop() is used to stop the thread, it cannot be restarted again. 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   suspend   stop basic   rare Q58. Will this code give error if i try to add two heterogeneous elements in the arraylist. ? and Why ? List list1 = new ArrayList<>(); list1.add(5); list1.add("5");
Ans. If we don't declare the list to be of specific type, it treats it as list of objects. int 1 is auto boxed to Integer and "1" is String and hence both are objects. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   collections   arraylist   list   autoboxing   wrapper classes expert   rare Q59. What is the difference between System.console.write and System.out.println ?
Ans. System.console() returns null if your application is not run in a terminal (though you can handle this in your application)System.console() provides methods for reading password without echoing charactersSystem.out and System.err use the default platform encoding, while the Console class output methods use the console encoding Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   system class   system.out.println   system.console.write   input output   java6 intermediate   rare Q60. Which load testing tools have you used ?
Ans. Rational Robot, JMeter, LoadRunner Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  testing   load testing   rational robot   jmeter   loadrunner   software tester basic   rare