Java Interview Questions And Answers For Freshers
Java is the name of a computing platform and programming language developed by Sun Microsystems. It is now owned by Oracle Corporation. The language is suited for the Internet and WWW technologies. It can also be used to develop a wide range of software applications that are not web-specific. The IT industry notifies for java-related jobs for both fresher aspirants as well as for more experienced professionals. The designations include – trainee coder, programmer, software engineer, senior software engineer, etc.,
The recruitment process varies from one company to another and includes written exam, group discussion, presentations, counseling, and interviews. Exams can include both theoretical understanding tests as well as coding. Questions And Answers (Q & A) are also useful in interviews which are technical in nature. Core or basic java covers data types, control structures, arrays, strings, objects, classes, object-based and object-oriented principles, and applets.
Fresh java coders and programmers have to concentrate on the following content from basic and core concepts for their interviews –
What was the initial name of Java?
The initial name given to Java was Oak, but it was changed due to trademark issues.
Name three application areas of Java?
Java is used in developing Web Applications, Embedded Systems, and Desktop Applications.
What are the five phases or steps in the execution of a Java program?
Java programs are executed in the following order – edit, compile, load, verify, and execute
Name any five significant features of Java programming language?
Java is object-oriented, platform-independent, multi-threaded, secure, and a robust language.
What is a thread and what do you mean by multi-threading?
A thread is a designated portion of a java program that performs a specific task. Multi-threading is the capability to execute more than one thread in parallel i.e. concurrently.
Check Here – Common Face to Face interview Questions
What is a java identifier?
The name used to identify any of the following java components is called an identifier – class, method, interface, or variable.
Give an example of syntax error in java?
Using a keyword that is reserved by the language as an identifier is a syntax error.
Name two keywords that are reserved but not used by java?
The two keywords that are reserved but not used by java are const and goto.
What is a compiler called in java and what does it do?
The java compiler is called javac and it converts source code into bytecodes.
What is the full form of JVM?
JVM stands for java virtual machine.
What is a java method?
A java method is an executable collection of statements that may or may not return a value.
Check Here – Java Interview Questions for Experienced
How many types of errors are there in java and what are their names?
There are three types of errors in java. They are syntax errors, logic errors, and runtime errors.
Given an example of logic error?
Placing a semicolon after the condition in a single selection ‘if’ structure is a logic error.
What is Java API?
The predefined classes in java are grouped together into related categories called packages. The collection of these packages is called Java API or Application Programming Interface.
What is a constructor?
A constructor is a method with the exact same name as the class that is used to initialize the instance variables of an object of the class when the object is instantiated.
What is a string and which class encapsulates it?
A string is a series of characters that are gathered together and enclosed in double quotes. The String class is found in the java.lang package.
What is method overriding?
The java feature that allows a subclass method to have the same name and signature as that of the super class is known as method overriding.
What is a static method?
A static method is a class-level method that cannot be overridden. It cannot have instance variables but can accept input from parameters, execute code, and return a result.
How are Java objects passed?
Java uses “reference semantics” and passes objects to methods by reference. However, Java primitive types are passed using “copy semantics”.
Name two java statements that are not used by structured programmers?
The two java statements that are avoided as per structured programming principles are break and continue.
Check Here – Basic Personal Interview Questions and Answers
What is an applet?
An applet is a small application in java which can be transmitted across a network as byte codes and executed at the user or client-end in a web browser.
How is memory management done in java?
Java virtual machines perform an integrated and automatic garbage collection to manage memory.
What are the four main features of OOPS?
The four main features of OOPS are Inheritance, Polymorphism, Encapsulation, and Abstraction.
Give three class specific rules in Java?
Java class extends java.lang.Object by default. A java class can have public or no modifying access specifier. A java class can implement any number of comma separated interfaces.
What is a java interface?
A java interface is a class-like construct which can have public, static and final variables along with method signatures i..e name, parameters, and exceptions. The methods cannot be implemented and they do not have code or body.
What is method overloading?
Java allows a class to have two or more methods with same name but different argument lists. This is called as method overloading.
Check Here- Tips to Crack IT Interview
What is an argument list?
An argument list is made up of number, data type, and sequence of parameters.
How many types of inheritance are there in java and what are their names?
There are four types of inheritance in java known as Single, Multiple, Multilevel and Hybrid inheritance.
What is JDK?
Java Development Kit is a software environment for developing applications. It has Java Runtime Environment and other development tools like compiler, interpreter, document generator, archiver, etc.,