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.
Ans. The first annotation will try to map the Class with the Table as of same name as Class whereas the second annotation will specify the Entity name as "EMPLOYEES" and hence will try to map with Table Name "EMPLOYEES".
Help us improve. Please let us know the company, where you were asked this question :
Ans. Instead of Saving Parent as well as Child Entities individually , Hibernate provides the option to persist / delete the related entities when the Parent is persisted.
Help us improve. Please let us know the company, where you were asked this question :
Q372. What are the annotations used in Junit with Junit4 ?
Ans. @Test
The Test annotation indicates that the public void method to which it is attached can be run as a test case.
@Before
The Before annotation indicates that this method must be executed before each test in the class, so as to execute some preconditions necessary for the test.
@BeforeClass
The BeforeClass annotation indicates that the static method to which is attached must be executed once and before all tests in the class.
@After
The After annotation indicates that this method gets executed after execution of each test.
@AfterClass
The AfterClass annotation can be used when a method needs to be executed after executing all the tests in a JUnit Test Case class so as to clean-up the set-up.
@Ignores
The Ignore annotation can be used when you want temporarily disable the execution of a specific test.
Help us improve. Please let us know the company, where you were asked this question :
Very frequently asked. Usually followed by questions related to private constructor and synchronized access. Frequently asked in JPMorgan and TCS (Based on 2 feedback)
Ans. They should be named all in upper case with underscore separating words.
Moreover the name should be such that it identifies the value. For example, if we are using constant for employee Id 123, it should be named something like EMPLOYEE_ID_123 and not EMPLOYEE_ID
Help us improve. Please let us know the company, where you were asked this question :
Ans. AssertionError is actually a fatal fault or a bug in the program. We may not like to continue program , request or thread execution if this error occurs as this condition is the assumption to continue further execution.
Help us improve. Please let us know the company, where you were asked this question :
Q383. Shall we keep the enumeration name in all capital letters as it contains all constants ?
Ans. Enum is actually a class with pre defined constants. So enum name should follow the convention of the Class name. Though the constant names or the Enum variables should follow the convention of having all capital letters.
Help us improve. Please let us know the company, where you were asked this question :
Ans. This is an informative annotation that specify that the interface is a functional interface. A Function Interface has only one abstract method and many default methods. Compiler generates an error if the interface specified with the annotation doesn't abide by the specifications for functional interface.
Help us improve. Please let us know the company, where you were asked this question :
Ans. They all does the same task i.e to compute statistical information on the stream of data. They differ by the way they store the statistical information as they expect a different data type of the values being used.
IntSummaryStatistics and LongSummaryStatistics expect non floating point values and hence stores the statistical information like min,max and sum as non floating values ( int or long ) whereas DoubleSummaryStatistics stores these information as floating value.
Help us improve. Please let us know the company, where you were asked this question :