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.
Q1081. If you are supposed to deprecate the method , Will you deprecate the method in the implementation class or will you deprecate the abstract declaration within interface or abstract class ?
Ans. Deprecating the interface / or declaration doesn't make much sense as the implementation is deprecated and not the interface.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Multi Level Inheritance is multi level hierarchy of classes. Here is the example - http://www.buggybread.com/2015/09/java-se-class-diagram-classes-that_603.html
Class RoleList extends ArrayList which in turn extends AbstractList which in turn extends AbstractCollection.
Help us improve. Please let us know the company, where you were asked this question :
if classes B and C extends Class A, Which of the following initialization is correct ?
B b = new C();
C c = new B();
B b = new A();
A a = new B();
Q1083. When do we generally get the database error - Unique Constraint Violated ?
Ans. This error can result either on an insert, update or delete when any change in data results in duplicate record or subset of it having unique constraint on record or its subset. For example - If we have a unique constraint on a combination of columns and then trying to insert duplicate column values.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Audit Tables generally stores Raw information to be reviewed in case of problems or determining impact. If Database space is an issue , and the audit information is rarely retrieved, one design could be to use compressed file system.
Help us improve. Please let us know the company, where you were asked this question :
Ans. When a DML is executed, the changes only stays in session and still not pushed to DB Tables, Commit is used to push those changes to the Tables.
In case we realize that we don't want to commit those changes and would like to ignore them, we can use rollback.
For example - You may like that for a banking transaction you would like to update the account balance only if the debit or credit record was correctly inserted, so you may like to encapsulate both DML's - insert for transaction and update for balance in a single transaction and would only commit if both succeeds else rollback.
Help us improve. Please let us know the company, where you were asked this question :
Q1087. Can I run a java program without creating any class ?
Ans. No, It requires creation of atleast one Class. Creating an object of that class is not compulsory as we can write all our logic within main method which is static.
Help us improve. Please let us know the company, where you were asked this question :
Q1088. What is the difference between print() and println() in Java ?
Ans. print method prints the argument passed to the method whereas println prints the argument and then prints the new line character. println is generally used if we want each output in a new line.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Constructor has the same name as class name whereas instance initialization block just have a body without any name or visibility type.
instance initialization blocks are useful if we want to have some code run regardless of which constructor is used or if we want to do some instance initialization for anonymous classes.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Broken Build means as unsuccessful build whereas unstable build means build was created successfully but one of the Post Build report failed or could be a Test failure.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Upstream project is a project whose successful build is required for executing the existing project build whereas Downstream project is the one that is waiting for the upstream project to build as it has the upstream project as dependency.
For example - X project has an upstream project y and downstream project Z. So It means X has dependency Y and is a dependency for Z.
Help us improve. Please let us know the company, where you were asked this question :
Ans. No, Main method is the entry point into an application. An application usually contain multiple classes to perform a function.
Lets take an example of a House, House usually have only one external Door and you may have internal doors to move around within a house. Internal Doors are methods of classes whereas External Door is a special method called main method.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Default methods results in multiple inheritance of behavior and not of state. In case we try to implement multiple interfaces with default method having same name and signature, and don't override it in implementation class, it will throw an error.
For example -
interface MyInterface {
public void default myMethod(){
}
}
interface MyInterface2 {
public void default myMethod(){
}
}
class MyClass implements MyInterface,MyInterface2 {
}
This code will compilation error "Duplicate Default Method"
if we specify the definition of myMethod() in myClass, compiler won't complain and there is no conflict and MyClass can use overridden definition. But if we don't override myMethod() in MyClass, Java would be in conflict as to what definition should be carried to MyClass and hence throws compilation error.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Copy Constructor is used for creating a duplicate of another object. Duplicate object will have the same state of the copied object but will have independent values in different memory locations. Copy Constructor can be useful to create duplicates of immutable objects as the Original cannot be tampered. Moreover It can be useful if base copies are required for individual requests in threading.
Help us improve. Please let us know the company, where you were asked this question :
Ans. PUT requests are only meant to place the object as it is on server. For example - You want a file to be uploaded and then placed in a particular folder or you want an Employee object to be persisted in the table.
POST requests are also meant to transfer information from client to server but that information once received at the server is evaluated , modified or refactored before persisting.
Help us improve. Please let us know the company, where you were asked this question :
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 :
Ans. Yes, compiler won't complain but at runtime it will give an error saying "Error: Main method not found in class". Even though we can use this method as any other private method, it cannot be invocate by executing the class.
Help us improve. Please let us know the company, where you were asked this question :
Ans. It is the ability to deploy changes on the fly without need to first build , deploy and then restart. All these functions happens on the fly as soon as the changes are made to the code.
Help us improve. Please let us know the company, where you were asked this question :
LikeDiscussCorrect / Improve  hot deployment  deployment   container   application server  production support
Q1110. Difference between Hot and Cold Deployment ?
Ans. Cold Deployment is a conventional deployment mechanism that follows the multi step process to deploy code changes to the running app i.e Build -> Deploy - Restart.
whereas
Hot Deployment is deployment changes on the fly without need to first build , deploy and then restart. All these functions happens on the fly as soon as the changes are made to the code.
Help us improve. Please let us know the company, where you were asked this question :
LikeDiscussCorrect / Improve  Hot deployment  cold deployment  application server  production support