Interview Questions and Answers - Order By Rating Q61. How to get collections from a Stream 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 8 Q62. Can anonymous class implement interface and extend a class 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  Ans. This class implements server sockets. A server socket waits for requests to come in over the network. It performs some operation based on that request, and then possibly returns a result to the requester. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q64. What are the distinguished qualities in Java that no other language possess ? Core Java
Ans. Java is widely adopted as an enterprise standard technology across business domains and technical domains ( Web , Desktop , mobile , data science etc ) and has a vast ecosystem of frameworks and libraries. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q65. What is headless mode in Java ? Why is it used ? Core Java
Ans. It’s a mode that can be used for creating Back end application without the front end UI.
The advantage is that it reduces the number of packages that needs to be loaded ( by ignoring ui packages ) Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java headless Q66. Write a code to detect the longest palindromic substring Core Java
This question was recently asked at 'Google'.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 Q67. What are the pros and cons of Lambda expressions ? 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   Asked in 1 Companies Q68. Write a program to rotate a matrix. Core Java
Ans. public class Matrix {
public static void main(String[] args) {
int[][] matrix = {
{1, 2, 3},
{4, 5, 6},
{7, 8, 9}
};
Matrix.rotateMatrix(matrix);
for (int i = 0; i < matrix.length; i ){
for (int j = 0; j < matrix.length; j ){
System.out.print(matrix[i][j] " ");
}
System.out.println();
}
}
public static void rotateMatrix(int[][] matrix){
int row = matrix.length;
//first find the transpose of the matrix.
for (int i = 0; i < row; i ){
for (int j = i; j < row; j ){
int temp = matrix[i][j];
matrix[i][j] = matrix[j][i];
matrix[j][i] = temp;
}
}
//reverse each row
for (int i = 0; i< row; i ){
for(int j = 0; j< row/2; j ){
int temp = matrix[i][j];
matrix[i][j] = matrix[i][row - 1 - j];
matrix[i][row - 1 - j] = temp;
}
}
}
} 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 'Fujitsu'.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 Q70. How do you achieve String immutability ? Core Java
This question was recently asked at 'Polaris'.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 Q71. Can we override behavior of a collection class ? How ? Core Java
Ans. Yes. We can do that.
1. We can create own own implementation class extending the collection class and then override the behavior method.
2. We can override the behavior at the time of instantiation of class as following
List<MyType> list = new ArrayList<MyType>() {
public boolean add(MyType mt) {
super.add(mt);
Collections.sort(list, comparator);
return true;
}
}; Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  collections Q72. What is the difference between map and filter methods in streams ? Core Java
Ans. By using map , you can transform the object values. The map operation allows us to apply a function, that takes input parameter of one type, and returns something else.
Filter is used for filtering the data, it always returns the boolean value. If it returns true, then item is added to list else its filtered out (ignored) Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java 8 Asked in 1 Companies This question was recently asked at '360Degree'.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 Q74. Explain how a class is loaded ? Core Java
Ans. Java classLoder is resposible to load java classes. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q75. What if we use all access specifiers ? Is it encapsulation ? Core Java
This question was recently asked at '3 Embeded Software 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 Q76. Difference between class and object with example. Core Java
This question was recently asked at 'TalenPace'.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 Q77. Is there a way to access a private method from an outside class ? Core Java
Ans. Through Reflection. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q78. What are the different types of inheritance ? Core Java
Ans. Single Level
Multi Level
Hierarchical
Multiple
Hybrid Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q79. Why in Java does it require "static" in the main function? Core Java
Ans. Because there needs to be a starting point till when there is no object created in memory and hence it needs to be run in static scope Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q80. Is it possible to have a static class ? Core Java
Ans. We can have a static inner class but not static outer class. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q81. Difference between List and LinkedList ? Core Java
Ans. A List is an child interface of collection interface in java where as Linked list is and implementation class of List interface which has doubly linked as a underlying data structure Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  linkedlist  list vs linkedlist Asked in 1 Companies Q82. Why packages are used 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   Q83. What is meant by platform ? Which platform does java provides ? Core Java
Ans. platform is the hardware or software environment in which a program runs. There are two types of platforms software-based and hardware-based. Java provides software-based platform. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q84. How can we drop cookies through back end code ? Does it transfer the cookie file to the client ? Java EE
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   Q85. Is it front end code or the back end code , that drops the cookies ? Java EE
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   Q86. Write an algorithm for square root of a given number. Core Java
This question was recently asked at 'IBM India'.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 Q87. Which is faster, LinkedList or ArrayList? Core Java
Ans. ArrayList is fast for random access, but is slow on deletion and insertion.
LinkedList is slow for random access, but is fast on deletion and insertion. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q88. Difference between function overloading and method overloading? Core Java
This question was recently asked at 'BroadBridge'.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 Q89. Which interface is used for hashset implementation ? Core Java
Ans. HashSet implements Set interface. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q90. why string pool concept for only String but not for StringBuffer ? Core Java
This question was recently asked at 'oodles technology'.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