Interview Questions and Answers - Order By Newest This question was recently asked at 'Improwea'.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 Q942. Why do we need ConcurrentHashMap ? Core Java
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   Q943. What is the default size of ArrayList ? Core Java
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   Q944. Find minimum operations required to convert one string to another. Allowed operation :Insertion Deletion Replace, all operational costs are same. Core Java
Ans. StringBuilder str = new StringBuilder("Pizza");
int size = str.length();
str = str.replace(size-1, size, "u");
System.out.println("After replace, str = " str); // prints Pizzu Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q945. Write code to read data from a file and write it to a file with 2 threads using the thread name content Core Java
This question was recently asked at 'verifone'.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  threads  file  file handling Asked in 1 Companies Q946. What is the difference between Interfaces and Abstract Classes with respect to Java 8 ? Core Java
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   Q947. Which of the OOP's feature - encapsulation or abstraction - is more important ? Core Java
Ans. Encapsulation facilitates security by hiding data and logic whereas Abstraction simplifies organization of data and related logic.
As applications scale, both concepts are required for easy management and maintenance. Encapsulation for security and criss cross communication between objects / modules will make it vulnerable. and Abstraction for better organization that enables better understanding of application code and easy maintainability. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  oops  oops features  oops concepts Q948. Which of the polymorphism type - static or runtime - is more important ? Core Java
Ans. Method overloading / static polymorphism compared to method overriding / runtime polymorphism has very limited usage as it just opens up an alternate way of defining a different method with the same name.
Method Overriding on other hand opens up many other features like contracting , interfacing , pluging development and hence development of libraries and frameworks. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  oops  oops features  oops concepts Q949. What is the reason that non-static method are not allowed to be referenced from a static context in Java?
Core Java
Ans. If we try to access an instance method from a static context , the compiler has no way to guess which instance method ( variable for which object ), you are referring to. Though, you can always access it using an object reference. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q950. Which are the thread safe / synchronized / concurrent classes in java collections ? Core Java
Ans. Stack
Properties
Vector
BlockingQueue
ConcurrentMap
ConcurrentNavigableMap Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  collections  concurrent classes Q951. What are the differences between Intermediate and Terminal Operations in Java 8 streams? Core Java
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   Q952. What is the difference between Collections.emptyList() and creating instance of a list ? Core Java
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   Q953. Which are the classes that implement java.util.List interface ? Core Java
Ans. ArrayList
LinkedList
Vector
Stack Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q954. Why do you think that Stack collection class implement List interface ? Core Java
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   Q955. What is the there only one method declared in Runnable interface? Core Java
Ans. The Runnable interface describes a class whose instances can be run as a thread. The interface itself is very simple, describing only one method ( run ) that is called automatically by Java when the thread is started. The Runnable interface is usually used in conjunction with the Thread class. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q956. What is difference between Executor.submit() and Executer.execute() method ? Core Java
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   Q957. What is difference between CyclicBarrier and CountDownLatch in Java ? Core Java
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   Q958. What do you mean by synchronized Non Access Modifier? Core Java
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   Q959. Name few classes of java.util.regex package ? Core Java
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   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   Q961. Explain toString method ? Which class contains this method ? Core Java
This question was recently asked at 'NEC 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 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   Q963. What will the following code print and Why
class Class1 {
static{
System.out.println("Wow");
}
public static final int xyz=1;
}
class Class2{
public static void main(String[] args) {
System.out.println(String.valueOf(Class1.xyz));
}
} Core Java
Ans. 1
Reason being that Class1.xyz is replaced with 1 during pre compilation only and a reference to Class1 is never made. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  static final   pre compilation Q964. Why java allows explicit import of class final static elements but not others ? Core Java
Ans. Because they can be replaced easily in pre compilation whereas others cannot. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q965. Why do we have multiple core java jars in java 9 ? Core Java
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  java 9  java modules   java 9 modules Q966. What is the concept of modules in Java 9 ? Core Java
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  java 9  java modules   java 9 modules Q967. How modules are different than packages in Java 9 ? Core Java
Ans. Modules are independently build units and contains multiple packages. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java 9  java modules   java 9 modules Q968. How Java 9 helps in building light weight applications ? Core Java
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  java 9  java modules   java 9 modules Q969. Do we need different class loaders for different modules in Java 9 ? Core Java
Ans. No, We can use the same class loader. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java 9  java modules   java 9 modules 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  java 9  java modules   java 9 modules