Interview Questions and Answers - Order By Newest 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 modulesAns. A Module layer is created from a graph of modules and is a function that maps modules to their class loaders. 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 Q1333. Difference between named and unnamed modules ? 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 Q1334. What is the use of Requires, Exports, Opens and provides within Module Descriptor ? Core Java
Ans. Requires specifies the dependencies for the module, i.e the modules required for this module to function.
Exports specifies the packages exported by the module.
Opens specifies the packages opened by the module.
Provides specifies the services provided by the module
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 Q1335. Does Java 9 allows same package within different modules ? Core Java
Ans. Yes it allows if the modules are mapped to different class loaders. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java 9  java 9 modules Q1336. What are the qualified and unqualified packages ? 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 9 modules Q1337. How does modularity in Java 9 facilitates better encapsulation ? Core Java
Ans. By providing dependencies , services and exports explicitly Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java 9  java 9 modules Q1338. How does Java 9 provides backward compatibility with libraries that haven't published themselves as modules ? Core Java
Ans. Though Automatic modules. Any JAR on the module path without module descriptor ends up as automatic module Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java 9  java 9 modules Q1339. What is the default setting for Automatic modules regarding exporting packages and reading modules ? Core Java
Ans. As one purpose of automatic module is to provide backward compatibility with the module less dependencies, automatic modules exports all packages and include all other modules. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java 9  java 9 modulesAns. JShell is a feature in java 9 using which we can code and test without compiling using javac and see the result of calculations directly. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  jshell  java 9 Q1341. Can we have private methods in interfaces ? Core Java
Ans. Yes, With Java 9 Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java 9 Q1342. What could be the reason for allowing private methods in java 9 ? Core Java
Ans. Java 8 allowed for method implementation using default methods in interfaces. As those default methods could contain complex logic and might need organizing the logic into multiple methods, they have allowed for private methods. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java 9  default methods Q1343. What is the difference between implementing interfaces and inheritance 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  Ans. A weak reference is a reference that gets removed on the next garbage collection cycle. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  weak reference  garbage collection Asked in 1 Companies   rare Q1345. Write a program that count the number of access to a method? Core Java
This question was recently asked at 'TrueCaller'.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 Q1346. Can you explain following exception
java.lang.ArithmeticException: Non-terminating decimal expansion; no exact representable decimal result. 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  ArithmeticException Q1347. What are we doing here
list.stream().collect(Collectors.groupingBy(ClassA::getElement1,
Collectors.averagingDouble(ClassA::getelement2))); Core Java
Ans. We are averaging elements of a collection by element1 grouped by element1
* list is the reference of collection
* element1 is the member element returned by getElement1 method of ClassA
* element2 is the member element returned by getElement2 method of ClassA Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java 8  collections  java 8 streams  collectors Q1348. What will the following code return
list.stream().collect(Collectors.groupingBy(ClassA::getElement1,
Collectors.averagingDouble(ClassA::getElement2))); Core Java
Ans. Map<DataType1,DataType2> where DataType1 is the data type of element1 ( returned by getelement1 method ) and DataType2 is the data type of element2 ( returned by getElement2 method ) Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java 8  collections  java 8 streams Q1349. What is the advantage of BidDecimal over Double ? Core Java
Ans. BigDecimal provides more precision as compared to double. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  BigDecimal  Double  data types Q1350. What is the difference between following rounding modes
RoundingMode.CEILING
RoundingMode.DOWN
RoundingMode.FLOOR
RoundingMode.HALF_DOWN
RoundingMode.HALF_UP
RoundingMode.HALF_EVEN
Which is the one you use often and Why ? 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  RoundingMode Q1351. Have you worked on creating any cron job ? 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   Q1352. Have you used any framework to capture command line arguments or options ? 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   Q1353. How would you choose your favorite company name for e.g. three companies are given in radio buttons Infosys, TCS and Aricent. Do You need to loop trough all radio buttons and select your favorite company or can just get the selected value. 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   Q1354. Write code to get count of every 5 letter word in a string using lambda expression
Core Java
Ans. String str = "I had been saying that he had been there";
Map<String,Long> countWords = Arrays.asList(str.split(" ")).stream().filter(p->p.length() = 5).collect(Collectors.groupingBy(p->p,Collectors.counting()));
System.out.println(countWords); Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  Collectors  lambda  filter  coding  java 8 Q1355. Can you write code so that we can keep track of Keys that have their values changed along with the number of times they were changed. 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   Q1356. What are the different types of methods in Java ? Core Java
Ans. Static Methods
Instance Methods
Accessor / Mutator or getter setters Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q1357. Are getters setter / accessor mutator methods instance methods or static methods ? why ? Core Java
Ans. They are usually instance methods. They are usually applied to DAOs / DTOs / POJO that are used to transport objects and used to access object elements. As they are tied to objects and are not common to all objects of a class, hence they are created as non static. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q1358. Design a class that find all files with SSN. Core Java
This question was recently asked at 'The Home Depot'.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 Q1359. Describe inheritance and polymorphism and their importance for OOP. Core Java
This question was recently asked at 'The Home Depot'.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 Q1360. What is the difference between instantiation and initialization ? Core Java
Ans. Instantiation is the process of reserving memory for the object
For ex -
List list = new ArrayList();
Initialization is the process of setting the default value for the object or default object construction.
List list = new ArrayList(set); Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve