What is difference between Comparable and Comparator interface 1) Comparable interface is in java.lang package Comparator interface is in java.util package ================================ 2) int compareTo(Object o1) method takes input as only object int compare(Object o1, Objecto2) method takes input as 2 object ================================ 3) java.lang.Comparable: int compareTo(Object inuptObject1) This method compares this object with inputObject1. Returned int value has the following meanings. 1. positive (this) object is greater than inuptObject1 2. zero (this) object equals to inuptObject1 3. negative (this) object is less than inuptObject1 java.util.Comparator: int compare(Object object1, Object object2) This method compares object1 and object2 objects. Returned int value has the following meanings. 1. positive object1 is greater than object2 2. zero ...
============================================== What is EMMA Code coverage. What do you understand by code coverage report? ============================================== Code coverage is a measure used in software testing. It describes the degree to which the source code of a program has been tested. To measure how well the program is exercised by a test suite, one or more coverage criteria are used. There are following types of criteria in general. 1) Function coverage - Has each function (or subroutine) in the program been called? 2) Statement coverage - Has each node in the program been executed? 3) Decision coverage - Has every IF and CASE statements been met as well as not met? 4) Condition coverage - Has each boolean sub-expression evaluated both to true and false? Attached is Emma-codeCoverage Te...
Memory management is the process of recognizing when allocated objects are no longer needed, deallocating (freeing) the memory used by such objects, and making it available for subsequent allocations. Garbage collection solves many, but not all, memory allocation problems. You could, for example, create objects indefinitely and continue referencing them until there is no more memory available. Garbage collection is also a complex task taking time and resources of its own. =========================== When does GarbageCollector will run What will happen if garbage collector is not able to free memory =========================== Consider the possibility that the garbage collector may never even run during an application's lifetime. There is no guarantee as to when or if the JVM will invoke the garbage collector -- even if a program explicitly calls System.gc() . Typically, the garbage collector won't be automatically run until a program needs more memory than is currently ava...
Comments
Post a Comment