Core Java - Interview Questions and Answers for 'Core Java' | Search Interview Question - javasearch.buggybread.com
Javasearch.buggybread.com

Search Interview Questions


 More than 3000 questions in repository.
 There are more than 900 unanswered questions.
Click here and help us by providing the answer.
 Have a video suggestion.
Click Correct / Improve and please let us know.
Label / Company      Label / Company / Text

   



Interview Questions and Answers - Order By Newest

   next 30
 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


 Q962. Explain pre compilation. 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     


 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


 Q970. What is ModuleDescriptor ?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


 Q971. What is ModuleLayer ?Core Java
Ans. 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


 Q972. 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


 Q973. 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


 Q974. 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


 Q975. 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


 Q976. 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


 Q977. 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


 Q978. 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 modules


 Q979. What is JShell?Core Java
Ans. 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


 Q980. 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


 Q981. 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


 Q982. 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     


 Q983. What is a weak reference ?Core Java
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


 Q984. 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


 Q985. 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


 Q986. 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


 Q987. 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


 Q988. 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


 Q989. 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


 Q990. 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     


previous 30   next 30

Help us and Others Improve. Please let us know the questions asked in any of your previous interview.

Any input from you will be highly appreciated and It will unlock the application for 10 more requests.

Company Name:
Questions Asked: