Interview Questions and Answers - Order By Newest Ans. Java Comparator compares two Java objects in a “compare(Object 01, Object 02)” format. Using configurable methods, Java Comparator can compare objects to return an integer based on a positive, equal or negative comparison Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q1612. How to make a collection thread safe? Core Java
This question was recently asked at 'Amodcs'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q1613. What is string pool and what is the use of intern() function ? Core Java
Ans. The Java String class intern() method returns the interned string. It returns the canonical representation of string. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q1614. What is Defer Parsing JavaScript ? JavaScript
This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  Ans. Throwable in java is a class that is the superclass of all exceptions and errors which may occurs in java program.It extends obcect class. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  exception handling   throwable Asked in 1 Companies basic Q1616. Hash map using/without using Java 8 Core Java
This question was recently asked at 'HCL Technologies'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q1617. Can we assign the reference to this variable ? Core Java
Ans. No Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q1618. What are different types of Polymorphism in Java ? Core Java
Ans. run time polymorphism
compile time polymorphism Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q1619. Is String mutable or immutable in Java ? Core Java
Ans. String is Immutable because of String Constant Pool. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies This question was recently asked at 'Whitesnow Software'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q1621. Should we do anything to avoid memory leaks in Java ? Core Java
Ans. Java has a intrinsic way of checking leaks and reclaiming memory called garbage collection. Moreover Java doesn't support pointer arithmetics , so there is very low comparative chance of memory leaks, compared to C,C++
Though there may be tools that may audit code to make sure that we are not leaving much for the garbage collection to work but I have never heard anyone doing anything for memory leaks in Java. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  memory leak in java Q1622. Write a Program to draw a fish ? Core Java
This question was recently asked at 'Webkul Software'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q1623. What is the difference between inheritance in PHP vs. Javascript? JavaScript
This question was recently asked at 'WePay'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  php  javascript Asked in 1 Companies Q1624. Write a method to track every click on a page. JavaScript
This question was recently asked at 'LinkedIn'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q1625. Have you had to work with memory leak problems in javascript ? JavaScript
This question was recently asked at 'RockYou'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q1626. prototypal inheritance in Javascript JavaScript
This question was recently asked at 'RocketMiles'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q1627. What is the use of defining equals , compareTo and hashcode methods in a class ? Where are they used ? Core Java
Ans. equals, compareTo and hashcode are of use when the objects are used within collections.
Equals helps with collections that helps maintaining only unique objects ( like Set )
compare and compareTo helps with collections that helps maintaining objects in order ( TreeSet, TreeMap etc )
hascode helps with collections that facilitates hash searching ( like hashSet, hashMap etc ) Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  equals   compareTo   hashcode method Q1628. Write a program to make an array act as a set. Core Java
Ans. public Set convertArrayToList(T array[]) {
Set set = new HashSet<>(Arrays.asList(array));
return set;
} Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  arrays  collections set Asked in 1 Companies Q1629. Write a unit test case using java 8. JUnit
Ans. public List convertAllToUpperCase(List words) {
return words.stream().map(String::toUpperCase).collect(Collectors.toList());
}
@Test
public void testAllToUpperCase() {
List expected = Arrays.asList("JAVA8", "STREAMS");
List result = convertAllToUpperCase(Arrays.asList("java8", "streams"));
assertEquals(expected, result);
} Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java8  java 8 Asked in 1 Companies Q1630. What are the advantages and disadvantages of Lambda Expression ? Core Java
This question was recently asked at 'Number 8'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java8  java 8  java lambda expressions Asked in 1 Companies Q1631. Can the value of a static variable be changed ? Core Java
Ans. Yes the value of a static variable can be changed. It's the final keyword that restrict the modification of value not static.
Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  static variables Q1632. Why wait(), notify(), notifyAll() methods are in Object class instead of Thread class? Core Java
Ans. wait() and notify() methods are defined in Object class rather than Thread class.If wait() and notify() were on the Thread instead then each thread would have to know the status of every other thread and there is no way to know thread1 that thread2 was waiting for any resource to access.Hence, notify, wait, notifyAll methods are defined in object class in Java. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q1633. How can we create an arraylist of unique values ? Core Java
Ans. We can put the value in a set to enforce uniqueness and then dum those value into an arraylist. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  arraylist  design  collections Q1634. Difference between Let and Var in Javascript ? JavaScript
Ans. Var scopes the variable to the nearest function whereas Let scopes the variable to nearest block.
For example -
function printNumbers() {
for(var i = 1; i < 3: i++){
console.log(i);
}
console.log(i); // works fine and will print 3 as i has a function scope and not local loop scope
} Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  let vs var in javascript  let vs var   difference between let and var Q1635. What are benefits of strongly typing variables ? JavaScript
This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  strong typing javascript Q1636. How is the declaration of enum in Typescript differ from Javascript ? TypeScript
This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  enum typescript  enum javascript This question was recently asked at 'Oracle financial services'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  interface vs abstraction  interfacing vs abstraction  relation between interface and abstraction  How interface provide abstraction Asked in 1 Companies Q1638. Explain Servlet config Java EE
This question was recently asked at 'Oracle financial services'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  servlet  servlet config Asked in 1 Companies Q1639. How Object-Oriented Programming is implemented in JavaScript? How they differ from other languages? Javascript
This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  object oriented programming in javascript  oops in javascript Q1640. How is cohesion achieved in JavaScript ? JavaScript
This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve