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. Garbage collection mechanism frees up the memory that is no longer needed. In languages like C / C++ the deallocation needs to be done explicitly by the programmer and hence any leniency may result in memory leak. Garbage collection in java ensures that all unused memory is reclaimed and hence there are no memory leaks.Moreover it relieves the programmer from the hassle of carefully releasing all memory.
Help us improve. Please let us know the company, where you were asked this question :
Ans. It's the way for synchronization wherein we can store version information in the table , so that if the same entity is updated by two transactions, the last to commit changes is informed of the conflict, and does not override the other transaction's work.
Help us improve. Please let us know the company, where you were asked this question :
Ans. This looks like the case for optimistic locking wherein hibernate suspects that the information in table was updated by some other transaction after the entity was loaded by current transaction.
One way is to have synchronized entity state and don't detach the entity. Other could be to merge the entity with the table record rather than just directly persisting the entity.
Help us improve. Please let us know the company, where you were asked this question :
Ans. The objective of an abstract class is to provide an interface as well as code reuse. Though we cannot instantiate an instance of abstract class but we can reuse the code by extending such a class. Moreover abstract class provides interfacing to outside components just like interfaces.
Help us improve. Please let us know the company, where you were asked this question :
Q1476. If we don't provide any argument to the executed program, What arguments will be passed to the main method ? Will the String array argument be null ?
Ans. Constructors are used to initialize the state of an object. If there are no constructor , objects won't have any initialized state and hence it's elements may contain garbage values. If the memory were used as is, the behavior of the object would also be unpredictable.
Help us improve. Please let us know the company, where you were asked this question :
Ans. JVM (Java Virtual Machine) is an abstract machine. It is a specification that provides runtime environment in which java bytecode can be executed.JVMs are available for many hardware and software platforms (i.e. JVM is platform dependent).Runtime Instance Whenever you write java command on the command prompt to run the java class, an instance of JVM is createdThe JVM performs following operation:Loads codeVerifies codeExecutes codeProvides runtime environment
Help us improve. Please let us know the company, where you were asked this question :
Ans. Counter controlled repetitions are the loops that are controlled with the use of counters or the loops where the number of repetitions are known in advance. for loop in java is the counter controlled repetition.
Help us improve. Please let us know the company, where you were asked this question :
Ans. It's a programming technique wherein the method can call itself. The method call usually involves a different set of parameters as otherwise it would lead to an infinite loop. There is usually a termination check and statement to finally return the control out of all function calls.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Yes, it's a project by confluent that provides in built mechanism for streaming records from bigdata data source to apache kafka message queues and vice versa. It provides a variety of source and sink connectors to achieve this.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Source connectors are the connectors that are used to get information from the source whereas sink connectors are used to deploy information to the destination.
Help us improve. Please let us know the company, where you were asked this question :
Ans. it depends on the implementation of equals method of the respective class. If no definition is provided and it uses the default definition of the object class, two references are equal only if they point to the same object.
We can have such an equality defined for a particular class objects if we provide appropriate implementation of equals method comparing all those fields.
Help us improve. Please let us know the company, where you were asked this question :
Ans. RMI uses a standard mechanism for communicating with remote objects i.e stubs and skeletons. A stub for a remote object acts as a client's local representative. The caller invokes a method on the local stub which is responsible for carrying out the method call on the remote object.
Stub resides at the client that upon calling whose method results in establishing connection with the server, serializing and mar shelling the request and then waiting for the response whereas skelton resides at the server that receives the request, unmarshal it and then deserialize to fulfil the request.
Help us improve. Please let us know the company, where you were asked this question :
Ans. synchronized is a keyword and a modifier. The synchronized keyword is used to indicate that a method can be accessed exclusively by one thread at a time.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Keyword is a reserved word that has a pre defined meaning for the compiler and hence cannot be used as an identifier, for example - final, private , for etc.
Identifier is the name given by the programmer to a programming construct, for example - class and method names etc.
java Keywords cannot be used as an identifier in java.
Help us improve. Please let us know the company, where you were asked this question :
Ans. If the number of input values is large, we can go about passing them as query params instead of path params. If the number is even larger and complex , its better to create a post service that behaves like a get service. Though this practice is not recommended but technically it can be accomplished.I dont mind doing it if the exceptionally large number of input would make it much more confusing.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Abstract classes provide a mechanism of interfacing ( using abstract method ) as well as code reuse through inheritance ( extending abstract class )
Comparing to concrete class they have an advantage of providing interface which a concrete class doesn't provide.
Comparing to interfaces they have an advantage of providing code reuse through inheritance which interfaces dont provide.