Core Java Interview Questions

Core Java Interview Questions

Freshers have plenty to stress out about as they step through their university gates for the first time. Between
registering for classes, packing, saying goodbye to friends and family, and fighting the social anxiety of being all alone for the first time, freshers have a lot on their plate. As the end of their first year approaches, they have another concern looming – the dreaded summer job and internship interviews. This guide is meant for those preparing for IT and programming interviews, and specifically looks at Java-related questions. We will discuss 6 basic core Java
interview questions and answers for freshers to practice.

Introduction

Much of the huge modern advancement in technology as we know it today is due to the breakthrough in computer technology innovation. Head-ways in both hardware and software development in computing have led to the creation of the sophisticated and complex systems. Continued improvement in software development languages has continuously increased the need to develop even more complex hardware systems to run the software. And much of the technological advancement in the world owes its success to this computer science and technology innovation.

Amongst the dozens of languages that have made computer science exponential advancement a possibility year in year out is Java. Java has unequivocally been the mainstay of telephony software and OS development. Much of the smartphone technology would be non-existent today without Java. And its importance doesn’t stop there. It would be practically impossible to imagine smooth operation and inter-task sharing in the sophisticated computer OS without Java.

Core Java is a reference phrase for the Standard Edition (SE) of the Java programming language. The phrase is used to draw a distinction from the other variants of the Java languages such as Java EE or Java ME. The thinly, often confusing distinction necessitated the development of the Core Java interview questions and answers in this article.

To help understand this Standard Edition of the language, and be able to face an interviewing panel with confidence, we will look at the most frequent Core Java interview questions and answers.

1. What are the basic features of Java?

This type of question provides a good opportunity for freshers to discuss their knowledge and interest in Java. It is a broad question meant to stimulate a conversation – interviewees should be careful not to simply recite a laundry list of features.Instead, they should think about why the features make Java unique and applicable to the role they are interviewing for.Some features that interviewees can discuss include Java’s:

· Platform independent language

· Simplicity

· Security

· High portability

· Object oriented (OO) programming features

· Robustness

· Architecture neutrality

· Dynamism

2. Explain what a variable is in a Java program

This type of question asks for specific Java knowledge. Now is not the time to ramble or go on a tangent. Answer what you can and if you forget, do not guess. There are clear right and wrong answers for this question, so study!A variable in a Java program is a memory location which is given some name. This memory location is assigned a value, which may change the type of the variable. The memory location size may change to correspond with the type of the variable.

3. What is an immutable object and can you write an immutable object?

Again, this type of question is fairly straightforward, and requires a simple, concise answer. Interviewees would do
well to study and memorize the textbook definition, although it is important to understand what an immutable object is.

Immutable classes are Java classes in which objects cannot be modified once they are created. Any type of modification to an immutable object will create a new object. Most immutable objects are also final in Java, to prevent sub classes from overriding Java methods that can compromise immutability.

4. Can you explain to me traversing through a collector using an Iterator?

The interviewer is looking to see how much hands on experience the interviewee has with actually writing Java code. It is important to be confident here, and explain your methodology clearly. In addition, interviewees would do well to clearly explain their logical process as they walk through each step.

Each element in the collection can be accessed by using Iterators no matter how they are organized in the collector. The Iterator can be implemented differently for each collection. To use an Iterator to traverse through a collector:

· Obtain an Iterator by calling the collections iterator () method to the start of the collection

· Set up a loop that makes a call to hasNext()

· Have the loop iterate as long as hasNext() returns true

· Within the loop, obtain each element by calling next()

· Use the remove() method to remove the current element in the iteration

5. How does a Java program compile?

This type of question is more open-ended, and looks for how well the interview fundamentally understands the Java
language. The interviewee should be prepared for follow-up questions to clarify or further expound upon their answers, but the basic points they should make are:

· The source file name must have the .java extension

·  Execute the java compiler

· A file is created called Myprog.class, which is the byte- code version of Myprog.java

· The byte-code is executed by the Java run time-system, Java Virtual Machine (JVM)

·  JVM is platform dependent

6. What does “System.out.println()” mean?

Further into the interview, the interviewer may pose some specific lines of code to see if the interviewee can explain
their meaning or purpose. This again is to see how experienced and knowledgeable they are about Java coding. Interviewees should remember to be clear and concise, and be prepared for any follow-up questions

· “System” is a predefined class

· The system class gives access to the system

· “out” is the output stream

· “println” is printing the line on the console

· this is a console output statement.

7. What is Marker Interface?

Marker Interface is very important when you’re using Java. Marker Interface means that there’s no real method of fields within it. A nickname for Marker Interface is Tag Interface. If you hear the Tag Interface it’s basically the same thing. Marker Interface is also a way to help you identify code, and for commenting.

In a quick conclusion: The Marker Interface is basically used to compiler. Some often suggest using Annotation instead.

8. What is Super?

Super is known as a basic keyword. It can be used inside when you see a sub-class method that can also be defined in
the super class. When you’re using the Super-class method private methods cannot be called. The only times that this super keyword can be used are when you have Protected and Public methods. This term is also used by the class
contractors so they’re able to involve constructors of its parent’s class.

9. What is overriding?

Some awesome benefits to Overriding in Java are that it helps you when you need to define a behavior that is specific to the certain sub class type it’s in and that means a subclass can implement a parent class method based on the specific requirements that is has.In simpler terms: You have the option to override a function of an already existing method.

10.What is Overloading?

Overloading happens is when you have a certain class and it allows it to have more than two names at the same time as long as the lists of arguments are different.What makes the Argument list different? The Data Type of Parameters and the number of parameters are what makes them different.

11. What is Dynamic Binding?

Dynamic Binding is a specific method at run time that is also in the process of connecting to a function. It’s also known as a “Procedure call.” In short, the function that is going to executed by the method still remains uncertain until the actual run time.

Conclusion

Studying and memorizing is critical to doing well, but also remember to always ask yourself how things are applied in actual coding. Interviewers are not just looking for bookworms – they are looking for coders who can immediately begin programming. I hope this guide to 6 basic core Java interview questions and answers for freshers is helpful. Good luck on your interviews!