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

Search Interview Questions


 2802 questions in repository.
 There are more than 200 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

   



Core Java - Interview Questions and Answers for 'Java' - 1579 question(s) found - Order By Rating

next 40
 Q1. What are the different ways to create objects in Java ?Core Java2018-12-07 07:32:23

 This question was recently asked at 'Posidex 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          Posidex Technologies


 Q2. Can we create object in static block ?Core Java2018-12-06 14:00:32

 This question was recently asked at 'DXC 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          DXC Technologies


 Q3. Explain servlet lifecycleJava EE2018-11-15 09:09:38

 This question was recently asked at 'United Health Group (UHG) ,7thOnline.com,Sumerge,NexThoughts,OpenText,Synechron'.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     United Health Group (UHG)   7thOnline.com  Sumerge  NexThoughts  OpenText  Synechron


 Q4. in the following class:
class A {
void methoda(Object o) {
Sysout("Object");
}

void methoda(String s) {
Sysout("String");
}

public static void main(String []args) {
A a = new A();
a.methoda(null);
}
}

what will be printed?
Core Java2018-11-14 12:51:08

Ans. String

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     Code  Coding  method overloading     Synechron


 Q5. How many read and write operations are provided at the same time by ConcurrentHashMaps ?Core Java2018-11-14 12:49:48

Ans. ConcurrentHashMaps provide unlimited read operation fro multi threaded environment. For write operation only one thread can change value for particular segment of map.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     ConcurrentHashMap     Synechron


 Q6. what is volatile and atomicCore Java2018-11-14 12:49:31

 This question was recently asked at 'Synechron'.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          Synechron


 Q7. serialization and deserialization of singleton classCore Java2018-11-14 12:48:59

Ans. The problem with serialized singleton class is that whenever we deserialize it, it will create a new instance of the class. To overcome this scenario all we need to do is to provide the implementation of readResolve() method.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     singleton  serialization     Synechron


 Q8. Can a double value be cast to a byte ?Core Java2018-11-14 12:47:55

 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     


 Q9. How do you convert List to Array ?Core Java2018-11-14 12:47:40

 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     



Do you think these are the Best Java Frameworks ?

OpenXavaSPRING MVCApache StripesCheck everything
that is Best in Java

Click Here



 Q10. Explain briefly about Queue Interface ?Core Java2018-11-14 12:47:27

 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     queue


 Q11. What is strictfp Modifier?Core Java2018-11-14 12:47:09

 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     strictfp


 Q12. What is the Main Advantage of the native Key Word?Core Java2018-11-14 12:46:51

 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     native keyword


 Q13. What is doCallRealMethod() method used for ?PowerMock2018-10-30 15:26:18

Ans. When we Mock an object and then make a reference to any method using mocked object reference , java never makes a call to that method and looks for mocked value to be returned or null if none specified. But If we want that to be overridden and want java to make actual method call upon using mocked object reference, this method can be used.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     junit  mocking  java unit testing


 Q14. What does the following code

MockitoAnnotations.initMocks(this);
Mockito2018-10-30 15:23:28

Ans. Initializes objects annotated with Mockito annotations

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     mocking  java mocking frameworks


 Q15. Why is Java platform independent ?Core Java2018-10-30 14:57:27

 This question was recently asked at 'Infosys'.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          Infosys


 Q16. What is the difference between the 'A' and "A" in Java ?Core Java2018-10-27 08:12:39

Ans. 'A' is a character whereas "A" is a String.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     


 Q17. What is the difference between bubble sort using Java and C++ ?Programming Language2018-10-27 08:01:39

 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     C++ vs Java


 Q18. Does Hashtable in Java use stack operation ?Core Java2018-10-27 08:01:06

 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     


 Q19. Differences between class not found exception and noclassdef found error ?Core Java2018-10-27 07:41:12

 This question was recently asked at 'Wipro'.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     exception handling  ClassNotFoundException  NoClassDefFoundError     Wipro



Do you think these are the Best Java Frameworks ?

OpenXavaSPRING MVCApache StripesCheck everything
that is Best in Java

Click Here



 Q20. Define CollectionCore Java2018-10-16 10:01:48

 This question was recently asked at 'Amber Road'.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          Amber Road


 Q21. What is type script ? What are the advantages of typescript ? How is it different than javascript ?TypeScript2018-10-15 11:52:15

 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     Typescript vs Javascript


 Q22. What is the use of final String when Strings are immutable ?Core Java2018-10-13 09:44:41

 This question was recently asked at 'Cyient'.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     string     Cyient


 Q23. How can we check class file format in java ?Core Java2018-09-16 16:27:41

 This question was recently asked at 'Jagan Institute of Management Studies (JIMS)'.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          Jagan Institute of Management Studies (JIMS)


 Q24. Why string pool concept has been introduced in string ?Core Java2018-09-07 09:01:59

Ans. Memory Sharing and Optimal memory utilization.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     String Pool     Tarang


 Q25. What will the following code print upon executing main method of Main class

public class BaseClass {

BaseClass(){
this(2);
System.out.println("Hello I am in Base Class Constructor");
}

BaseClass(int i){
System.out.println("Hello I am in Base Class int argument Constructor");
}
}

public class DerivedClass extends BaseClass{
DerivedClass(){
System.out.println("Hello I am in Derived Class Constructor");
}
}

public class Main {

public static void main(String[] args) {
    DerivedClass derivedClass = new DerivedClass();
}
}
Core Java2018-09-06 08:46:44

Ans. Hello I am in Base Class int argument Constructor
Hello I am in Base Class Constructor
Hello I am in Derived Class Constructor

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     constructor


 Q26. What will the following code print upon executing main method of Main class

public class BaseClass {

BaseClass(){
this(2);
System.out.println("Hello I am in Base Class Constructor");
}

BaseClass(int i){
System.out.println("Hello I am in Base Class int argument Constructor");
}
}

public class DerivedClass extends BaseClass{
DerivedClass(){
super(1);
System.out.println("Hello I am in Derived Class Constructor");
}
}

public class Main {

public static void main(String[] args) {
    DerivedClass derivedClass = new DerivedClass();
}
}
Core Java2018-09-06 08:46:04

Ans. Hello I am in Base Class int argument Constructor
Hello I am in Derived Class Constructor

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     constructor


 Q27. Why line 4 in this code gives error saying "Cannot be referenced from a static context" ?

public class OuterClass {

public static void main(String[] args){
InnerClass innerClass = new InnerClass();
}

class InnerClass {

}
}
Core Java2018-09-05 15:09:21

Ans. InnerClass is a non static inner class and hence can only be instantiated using instance of the outer class.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     inner class


 Q28. What will the following code print upon executing main method of Main class ?

public class BaseClass {
BaseClass(int x){
System.out.println("Hello I am in Base Class Constructor");
}
}

public class DerivedClass extends BaseClass{
DerivedClass(){
super(1);
System.out.println("Hello I am in Derived Class Constructor");
}
}

public class Main {

public static void main(String[] args) {
    DerivedClass derivedClass = new DerivedClass();
}
}
Core Java2018-09-05 09:52:37

Ans. Hello I am in Base Class Constructor
Hello I am in Derived Class Constructor

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     constructor


 Q29. What will the following code print upon executing main method of Main class ?

public class BaseClass {
BaseClass(int x){
System.out.println("Hello I am in Base Class Constructor");
}
}

public class DerivedClass extends BaseClass{
DerivedClass(){
System.out.println("Hello I am in Derived Class Constructor");
}
}

public class Main {

public static void main(String[] args) {
    DerivedClass derivedClass = new DerivedClass();
}
}
Core Java2018-09-05 09:51:30

Ans. Compilation error as there is no default constructor available in BaseClass.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     constructor



Do you think these are the Best Java Frameworks ?

OpenXavaSPRING MVCApache StripesCheck everything
that is Best in Java

Click Here



 Q30. What will the following code print upon executing main method of Main class ?

public class BaseClass {
BaseClass(){
System.out.println("Hello I am in Base Class Constructor");
}
}

public class DerivedClass extends BaseClass{
DerivedClass(){
System.out.println("Hello I am in Derived Class Constructor");

super();
}
}

public class Main {

public static void main(String[] args) {
    DerivedClass derivedClass = new DerivedClass();
}
}

Core Java2018-09-05 09:50:04

Ans. There will be compilation error within constructor of Derived Class as "super must be the first statement in constructor body".

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     constructor


 Q31. What will the following print upon executing main method of Main class ?

public class BaseClass {
BaseClass(){
System.out.println("Hello I am in Base Class Constructor");
}
}

public class DerivedClass extends BaseClass{
DerivedClass(){
System.out.println("Hello I am in Derived Class Constructor");
}
}

public class Main {

public static void main(String[] args) {
    DerivedClass derivedClass = new DerivedClass();
}
}
Core Java2018-09-05 09:48:18

Ans. Hello I am in Base Class Constructor
Hello I am in Derived Class Constructor

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     constructor


 Q32. Will it print the message in Base Class constructor if we execute main method of Main class ? why ?

public class BaseClass {
BaseClass(){
System.out.println("Hello I am in Base Class Constructor");
}
}

public class DerivedClass extends BaseClass{
}

public class Main {

public static void main(String[] args) {
    DerivedClass derivedClass = new DerivedClass();
}
}
Core Java2018-09-05 09:45:42

Ans. Yes.

When the Derived class constructor is initialized , a no argument super will be called intrinsically.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     constructor


 Q33. Isnt the use of HashTable and ConcurrentHashMap the same, i.e providing synchronized map collection ?Core Java2018-08-30 08:37:45

 This question was recently asked at 'Tata Consultancy'.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     synchronized collections  hashtable  ConcurrentHashMap     Tata Consultancy


 Q34. Can we use try within catch block ?Core Java2018-08-28 15:41:21

Ans. Yes

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve          Ness Technologies


 Q35. Is java fully platform independent ?Core Java2018-08-27 13:13:05

 This question was recently asked at 'National Informatics Centre (NIC)'.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          National Informatics Centre (NIC)


 Q36. Can you write immutable class without final?Core Java2018-08-27 13:12:25

 This question was recently asked at 'Wells Fargo'.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          Wells Fargo


 Q37. Does Java SE has Immutable collections ?Core Java2018-08-09 08:54:04

Ans. Yes wef from Java 9

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     java 9  java9  immutable collections


 Q38. Where to use interface and abstract class ?Core Java2018-08-06 14:52:09

 This question was recently asked at 'Exterro'.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          Exterro


 Q39. What are basic functions of OOPS ?Core Java2018-08-06 14:51:48

 This question was recently asked at 'Zillious'.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          Zillious



Do you think these are the Best Java Frameworks ?

OpenXavaSPRING MVCApache StripesCheck everything
that is Best in Java

Click Here



 Q40. Write a java program to find the maximum profit in day tradingCore Java2018-08-06 14:51:27

 This question was recently asked at 'Capital One'.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          Capital One


next 40


Subscribe to Java News and Posts. Get latest updates and posts on Java from Buggybread.com
Enter your email address:
Delivered by FeedBurner



comments powered by Disqus
 

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:
         

X Close this

X Close this

Help Us Improve.
Please share your
interview experience.

Company Name:   


Questions Asked: