SlideShare a Scribd company logo
JAVA INTERVIEW QUESTIONS FOR FRESHERS
Why Java is platform independent?
Java is called platform independent because of its byte codes which can run on any
system irrespective of its underlying operating system.
Why Java is not 100%Object-oriented?
Java is not 100% Object-oriented becauseit makes use of eight primitive data
types such as boolean, byte, char, int, float, double, long, short which are not
objects.
What are constructors in Java?
In Java, constructorrefers to a block of codewhich is used to initialize an object. It
must have the same name as that of the class. Also, it has no return type and it is
automatically called when an object is created.
There are two types of constructors:
1. Default Constructor: In Java, a default constructoris the one which does
not take any inputs. In other words, default constructors are the no argument
constructors which will be created by default in case you no other
constructoris defined by the user. Its main purposeis to initialize the
instance variables with the default values. Also, it is majorly used for object
creation.
2. ParameterizedConstructor: The parameterized constructorin Java, is the
constructorwhich is capable of initializing the instance variables with the
provided values. In other words, the constructors which take the arguments
are called parameterized constructors.
Why pointers are not used in Java?
Java doesn’tuse pointers because they are unsafe and increases the complexity of
the program. Since, Java is known for its simplicity of code, adding the conceptof
pointers will be contradicting. Moreover, since JVM is responsible for implicit
memory allocation, thus in order to avoid direct access to memory by the
user, pointers are discouraged in Java.
What is the difference between an array and an array list?
Array ArrayList
Cannot contain values of different
data types
Can contain values of different data types.
Size must be defined at the time of
declaration
Size can be dynamically changed
Need to specify the index in order to
add data
No need to specify the index
Arrays are not type parameterized Arraylists are type
Arrays can contain primitive data
types as well as objects
Arraylists can contain only objects, no
primitive data types are allowed
What is a Map in Java?
In Java, Map is an interface of Util package which maps unique keys to values.
The Map interface is not a subset of the main Collection interface and thus it
behaves little different from the other collection types. Below are a few of the
characteristics of Map interface:
1. Map doesn’tcontain duplicate keys.
2. Each key can map at max one value.
What is a classloaderin Java?
The Java ClassLoader is a subsetof JVM (Java Virtual Machine) that is
responsible for loading the class files. Whenever a Java program is executed it is
first loaded by the classloader. Java provides three built-in classloaders:
1. Bootstrap ClassLoader
2. Extension ClassLoader
3. System/Application ClassLoader
What are access modifiers in Java?
In Java, access modifiers are special keywords which are used to restrict the access
of a class, constructor, data member and method in another class. Java supports
four types of access modifiers:
1. Default
2. Private
3. Protected
4. Public
Define a Java Class.
A class in Java is a blueprint which includes all your data. A class contains fields
(variables) and methods to describe the behavior of an object. Let’s have a look at
the syntax of a class.
1
2
3
class Abc {
member variables // class body
methods}
What is an objectin Java and how is it created?
An object is a real-world entity that has a state and behavior. An object has three
characteristics:
1. State
2. Behavior
3. Identity
An object is created using the ‘new’ keyword. For example:
ClassName obj= new ClassName();
OOPS Java Interview Questions
What is run time polymorphism and compile time polymorphism?
Compile time polymorphism is method overloading whereas Runtime time
polymorphism is done using inheritance and interface.
In Java, runtime polymorphism or dynamic method dispatch is a process in which
a call to an overridden method is resolved at runtime rather than at compile-time.
In this process, an overridden method is called through the reference variable of a
superclass. Let’s take a look at the example below to understand it better.
What is abstractionin Java?
Abstraction refers to the quality of dealing with ideas rather than events. It
basically deals with hiding the details and showing the essential things to the user.
Thus you can say that abstraction in Java is the process ofhiding the
implementation details from the user and revealing only the functionality to them.
Abstraction can be achieved in two ways:
1. Abstract Classes (0-100% of abstraction can be achieved)
2. Interfaces (100% of abstraction can be achieved)
What do you mean by an interface in Java?
An interface in Java is a blueprint of a class or you can say it is a collection of
abstract methods and static constants. In an interface, each method is public and
abstract but it does not contain any constructor. Thus, interface basically is a group
of related methods with empty bodies.
Example:
public interface Animal {
public void eat();
public void sleep();
public void run();
}
What is inheritance in Java?
Inheritance in Java is the conceptwhere the properties of one class can be inherited
by the other. It helps to reuse the codeand establish a relationship between
different classes. Inheritance is performed between two types of classes:
1. Parent class (Super or Base class)
2. Child class (Subclass or Derived class)
A class which inherits the properties is known as Child Class whereas a class
whose properties are inherited is known as Parent class.
What are the different types of inheritance in Java?
Java supports four types of inheritance which are:
1. Single Inheritance: In single inheritance, one class inherits the properties of
another i.e there will be only one parent as well as one child class.
2. Multilevel Inheritance: When a class is derived from a class which is also
derived from another class, i.e. a class having more than one parent class but
at different levels, such type of inheritance is called Multilevel Inheritance.
3. HierarchicalInheritance: When a class has more than one child classes
(subclasses)or in other words, more than one child classes have the same
parent class, then such kind of inheritance is known as hierarchical.
4. Hybrid Inheritance: Hybrid inheritance is a combination of two or more
types of inheritance.
What is method overloading and method overriding?
Method Overloading :
 In Method Overloading, Methods of the same class shares the same name
but each method must have a different number of parameters or parameters
having different types and order.
 Method Overloading is to “add”or “extend” more to the method’s behavior.
 It is a compile-time polymorphism.
 The methods must have a different signature.
 It may or may not need inheritance in Method Overloading.
Method Overriding:
 In Method Overriding, the subclass has the same method with the same
name and exactly the same number and type of parameters and same return
type as a superclass.
 Method Overriding is to “Change” existing behavior of the method.
 It is a run time polymorphism.
 The methods must have the same signature.
 It always requires inheritance in Method Overriding.
What is multiple inheritance? Is it supported by Java?
If a child class inherits the property from multiple classes is known as multiple
inheritance. Java does not allow to extend multiple classes.
The problem with multiple inheritance is that if multiple parent classes have the
same method name, then at runtime it becomes difficult for the compiler to decide
which method to execute from the child class.
Therefore, Java doesn’tsupportmultiple inheritance. The problem is commonly
referred to as Diamond Problem.
In case you are facing any challenges with these java interview questions, please
comment on your problems in the section below.
What is encapsulationin Java?
Encapsulation is a mechanism where you bind your data(variables) and
code(methods)together as a single unit. Here, the data is hidden from the outer
world and can be accessed only via current class methods. This helps in protecting
the data from any unnecessary modification. We can achieve encapsulation in Java
by:
 Declaring the variables of a class as private.
 Providing public setter and getter methods to modify and view the values of
the variables.
Servlets – Java Interview Questions
What is RequestDispatcher?
RequestDispatcher interface is used to forward the request to another resource that
can be HTML, JSP or another servlet in same application. We can also use this to
include the content of another resource to the response.
There are two methods defined in this interface:
1.void forward()
2.void include()
What is the life-cycle of a servlet?
There are 5 stages in the lifecycle of a servlet:
1. Servlet is loaded
2. Servlet is instantiated
3. Servlet is initialized
4. Service the request
5. Servlet is destroyed
. What are the different methods of sessionmanagementin servlets?
Some of the common ways of session management in servlets are:
1. User Authentication
2. HTML Hidden Field
3. Cookies
4. URL Rewriting
5. Session Management API
JDBC – Java Interview Questions
What is JDBC Driver?
JDBC Driver is a software componentthat enables java application to interact with
the database. There are 4 types of JDBC drivers:
1. JDBC-ODBC bridge driver
2. Native-API driver (partially java driver)
3. Network Protocoldriver (fully java driver)
4. Thin driver (fully java driver)
What are the JDBC API components?
The java.sql package contains interfaces and classes for JDBC API.
Interfaces:
 Connection
 Statement
 PreparedStatement
 ResultSet
 ResultSetMetaData
 DatabaseMetaData
 CallableStatement etc.
Classes:
 DriverManager
 Blob
 Clob
 Types
 SQLException etc.
What is the role of JDBC DriverManagerclass?
The DriverManager class manages the registered drivers. It can be used to register
and unregister drivers. It provides factory method that returns the instance of
Connection.
What is JDBC Connectioninterface?
The Connection interface maintains a sessionwith the database. It can be used for
transaction management. It provides factory methods that returns the instance of
Statement, PreparedStatement, CallableStatement and DatabaseMetaData.
What are the steps to connectto a database in java?
 Registering the driver class
 Creating connection
 Creating statement
 Executing queries
 Closing connection
What is JDBC DatabaseMetaDatainterface?
The DatabaseMetaData interface returns the information of the database such as
username, driver name, driver version, number of tables, number of views etc.
Spring Framework – Java Interview Questions
List some of the important annotations in annotation-basedSpring
configuration.
The important annotations are:
 @Required
 @Autowired
 @Qualifier
 @Resource
 @PostConstruct
 @PreDestroy
What is autowiring in Spring? What are the autowiring modes?
Autowiring enables the programmer to inject the bean automatically. We don’t
need to write explicit injection logic.
The autowiring modes are given below:
No, by name, by type, constructor
Name the types of transactionmanagement that Spring supports.
Programmatic transaction management
Declarative transaction management
JSP – Java Interview Questions
What are the different tags provided in JSTL?
There are 5 type of JSTL tags.
1. core tags
2. sqltags
3. xml tags
4. internationalization tags
5. functions tags
How to disable sessionin JSP?
1. <%@ page session=“false” %>
Exception and Thread Java Interview Questions
How can you handle Java exceptions?
There are five keywords used to handle exceptions in Java:
1. try
2. catch
3. finally
4. throw
5. throws
What are the important methods of Java Exception Class?
String getMessage()
String getLocalizedMessage()
Synchronized Throwable getCause()
String toString()
void printStackTrace()
What is OutOfMemoryError in Java?
OutOfMemoryError is the subclass of java.lang.Error which generally occurs when
our JVM runs out of memory.
What are the two ways to create a thread?
In Java, threads can be created in the following two ways:-
 By implementing the Runnable interface.
 By extending the Thread
Ad

More Related Content

What's hot (20)

Basics of Java
Basics of JavaBasics of Java
Basics of Java
Sherihan Anver
 
Java basic concept
Java basic conceptJava basic concept
Java basic concept
University of Potsdam
 
OCA Java SE 8 Exam Chapter 2 Operators & Statements
OCA Java SE 8 Exam Chapter 2 Operators & StatementsOCA Java SE 8 Exam Chapter 2 Operators & Statements
OCA Java SE 8 Exam Chapter 2 Operators & Statements
İbrahim Kürce
 
Chapter 01 Introduction to Java by Tushar B Kute
Chapter 01 Introduction to Java by Tushar B KuteChapter 01 Introduction to Java by Tushar B Kute
Chapter 01 Introduction to Java by Tushar B Kute
Tushar B Kute
 
The Go Programing Language 1
The Go Programing Language 1The Go Programing Language 1
The Go Programing Language 1
İbrahim Kürce
 
DBMS and Rdbms fundamental concepts
DBMS and Rdbms fundamental conceptsDBMS and Rdbms fundamental concepts
DBMS and Rdbms fundamental concepts
Kuntal Bhowmick
 
Generics
GenericsGenerics
Generics
Ravi_Kant_Sahu
 
Ap Power Point Chpt7
Ap Power Point Chpt7Ap Power Point Chpt7
Ap Power Point Chpt7
dplunkett
 
Unit 1 Java
Unit 1 JavaUnit 1 Java
Unit 1 Java
arnold 7490
 
Lecture 8 Library classes
Lecture 8 Library classesLecture 8 Library classes
Lecture 8 Library classes
Syed Afaq Shah MACS CP
 
OOP java
OOP javaOOP java
OOP java
xball977
 
Functional Programming You Already Know - Kevlin Henney - Codemotion Rome 2015
Functional Programming You Already Know - Kevlin Henney - Codemotion Rome 2015Functional Programming You Already Know - Kevlin Henney - Codemotion Rome 2015
Functional Programming You Already Know - Kevlin Henney - Codemotion Rome 2015
Codemotion
 
Wrapper classes
Wrapper classesWrapper classes
Wrapper classes
Ravi_Kant_Sahu
 
Object oriented programming in java
Object oriented programming in javaObject oriented programming in java
Object oriented programming in java
Elizabeth alexander
 
OCA Java SE 8 Exam Chapter 3 Core Java APIs
OCA Java SE 8 Exam Chapter 3 Core Java APIsOCA Java SE 8 Exam Chapter 3 Core Java APIs
OCA Java SE 8 Exam Chapter 3 Core Java APIs
İbrahim Kürce
 
Structure of java program diff c- cpp and java
Structure of java program  diff c- cpp and javaStructure of java program  diff c- cpp and java
Structure of java program diff c- cpp and java
Madishetty Prathibha
 
Java essentials for hadoop
Java essentials for hadoopJava essentials for hadoop
Java essentials for hadoop
Seo Gyansha
 
OCA Java SE 8 Exam Chapter 1 Java Building Blocks
OCA Java SE 8 Exam Chapter 1 Java Building BlocksOCA Java SE 8 Exam Chapter 1 Java Building Blocks
OCA Java SE 8 Exam Chapter 1 Java Building Blocks
İbrahim Kürce
 
C++ Object oriented concepts & programming
C++ Object oriented concepts & programmingC++ Object oriented concepts & programming
C++ Object oriented concepts & programming
nirajmandaliya
 
Java se 8 fundamentals
Java se 8 fundamentalsJava se 8 fundamentals
Java se 8 fundamentals
megharajk
 
OCA Java SE 8 Exam Chapter 2 Operators & Statements
OCA Java SE 8 Exam Chapter 2 Operators & StatementsOCA Java SE 8 Exam Chapter 2 Operators & Statements
OCA Java SE 8 Exam Chapter 2 Operators & Statements
İbrahim Kürce
 
Chapter 01 Introduction to Java by Tushar B Kute
Chapter 01 Introduction to Java by Tushar B KuteChapter 01 Introduction to Java by Tushar B Kute
Chapter 01 Introduction to Java by Tushar B Kute
Tushar B Kute
 
The Go Programing Language 1
The Go Programing Language 1The Go Programing Language 1
The Go Programing Language 1
İbrahim Kürce
 
DBMS and Rdbms fundamental concepts
DBMS and Rdbms fundamental conceptsDBMS and Rdbms fundamental concepts
DBMS and Rdbms fundamental concepts
Kuntal Bhowmick
 
Ap Power Point Chpt7
Ap Power Point Chpt7Ap Power Point Chpt7
Ap Power Point Chpt7
dplunkett
 
Functional Programming You Already Know - Kevlin Henney - Codemotion Rome 2015
Functional Programming You Already Know - Kevlin Henney - Codemotion Rome 2015Functional Programming You Already Know - Kevlin Henney - Codemotion Rome 2015
Functional Programming You Already Know - Kevlin Henney - Codemotion Rome 2015
Codemotion
 
Object oriented programming in java
Object oriented programming in javaObject oriented programming in java
Object oriented programming in java
Elizabeth alexander
 
OCA Java SE 8 Exam Chapter 3 Core Java APIs
OCA Java SE 8 Exam Chapter 3 Core Java APIsOCA Java SE 8 Exam Chapter 3 Core Java APIs
OCA Java SE 8 Exam Chapter 3 Core Java APIs
İbrahim Kürce
 
Structure of java program diff c- cpp and java
Structure of java program  diff c- cpp and javaStructure of java program  diff c- cpp and java
Structure of java program diff c- cpp and java
Madishetty Prathibha
 
Java essentials for hadoop
Java essentials for hadoopJava essentials for hadoop
Java essentials for hadoop
Seo Gyansha
 
OCA Java SE 8 Exam Chapter 1 Java Building Blocks
OCA Java SE 8 Exam Chapter 1 Java Building BlocksOCA Java SE 8 Exam Chapter 1 Java Building Blocks
OCA Java SE 8 Exam Chapter 1 Java Building Blocks
İbrahim Kürce
 
C++ Object oriented concepts & programming
C++ Object oriented concepts & programmingC++ Object oriented concepts & programming
C++ Object oriented concepts & programming
nirajmandaliya
 
Java se 8 fundamentals
Java se 8 fundamentalsJava se 8 fundamentals
Java se 8 fundamentals
megharajk
 

Similar to Java Interview Questions For Freshers (20)

100 Java questions FOR LOGIC BUILDING SOFTWARE.docx
100 Java questions FOR LOGIC BUILDING SOFTWARE.docx100 Java questions FOR LOGIC BUILDING SOFTWARE.docx
100 Java questions FOR LOGIC BUILDING SOFTWARE.docx
MaheshRamteke3
 
Java Interview Questions
Java Interview QuestionsJava Interview Questions
Java Interview Questions
Kuntal Bhowmick
 
__ Java Technical round questions .pdf soo
__ Java Technical round questions .pdf soo__ Java Technical round questions .pdf soo
__ Java Technical round questions .pdf soo
Rajkumar751652
 
Suga java training_with_footer
Suga java training_with_footerSuga java training_with_footer
Suga java training_with_footer
Sugavanam Natarajan
 
Java interview questions and answers for cognizant By Data Council Pune
Java interview questions and answers for cognizant By Data Council PuneJava interview questions and answers for cognizant By Data Council Pune
Java interview questions and answers for cognizant By Data Council Pune
Pankaj kshirsagar
 
Java_Interview Qns
Java_Interview QnsJava_Interview Qns
Java_Interview Qns
ManikandanRamanujam
 
Java Faqs useful for freshers and experienced
Java Faqs useful for freshers and experiencedJava Faqs useful for freshers and experienced
Java Faqs useful for freshers and experienced
yearninginjava
 
Top 371 java fa qs useful for freshers and experienced
Top 371 java fa qs useful for freshers and experiencedTop 371 java fa qs useful for freshers and experienced
Top 371 java fa qs useful for freshers and experienced
Gaurav Maheshwari
 
Presentation2.ppt java basic core ppt .
Presentation2.ppt  java basic core ppt .Presentation2.ppt  java basic core ppt .
Presentation2.ppt java basic core ppt .
KeshavMotivation
 
JAVA VIVA QUESTIONS_CODERS LODGE.pdf
JAVA VIVA QUESTIONS_CODERS LODGE.pdfJAVA VIVA QUESTIONS_CODERS LODGE.pdf
JAVA VIVA QUESTIONS_CODERS LODGE.pdf
nofakeNews
 
1669617800196.pdf
1669617800196.pdf1669617800196.pdf
1669617800196.pdf
venud11
 
Nitish Chaulagai Java1.pptx
Nitish Chaulagai Java1.pptxNitish Chaulagai Java1.pptx
Nitish Chaulagai Java1.pptx
NitishChaulagai
 
Java questions for interview
Java questions for interviewJava questions for interview
Java questions for interview
Kuntal Bhowmick
 
Top 30 Java Phone Interview Questions Answers for Freshers, 1 to 2 Years Expe...
Top 30 Java Phone Interview Questions Answers for Freshers, 1 to 2 Years Expe...Top 30 Java Phone Interview Questions Answers for Freshers, 1 to 2 Years Expe...
Top 30 Java Phone Interview Questions Answers for Freshers, 1 to 2 Years Expe...
SynergisticMedia
 
Core Java Interview Questions PDF By ScholarHat
Core Java Interview Questions PDF By ScholarHatCore Java Interview Questions PDF By ScholarHat
Core Java Interview Questions PDF By ScholarHat
Scholarhat
 
25 java interview questions
25 java interview questions25 java interview questions
25 java interview questions
Mehtaacademy
 
Java interview questions
Java interview questionsJava interview questions
Java interview questions
G C Reddy Technologies
 
Java Basics Presentation
Java Basics PresentationJava Basics Presentation
Java Basics Presentation
Omid Sohrabi
 
20 most important java programming interview questions
20 most important java programming interview questions20 most important java programming interview questions
20 most important java programming interview questions
Gradeup
 
1
11
1
ksuthesan
 
100 Java questions FOR LOGIC BUILDING SOFTWARE.docx
100 Java questions FOR LOGIC BUILDING SOFTWARE.docx100 Java questions FOR LOGIC BUILDING SOFTWARE.docx
100 Java questions FOR LOGIC BUILDING SOFTWARE.docx
MaheshRamteke3
 
Java Interview Questions
Java Interview QuestionsJava Interview Questions
Java Interview Questions
Kuntal Bhowmick
 
__ Java Technical round questions .pdf soo
__ Java Technical round questions .pdf soo__ Java Technical round questions .pdf soo
__ Java Technical round questions .pdf soo
Rajkumar751652
 
Java interview questions and answers for cognizant By Data Council Pune
Java interview questions and answers for cognizant By Data Council PuneJava interview questions and answers for cognizant By Data Council Pune
Java interview questions and answers for cognizant By Data Council Pune
Pankaj kshirsagar
 
Java Faqs useful for freshers and experienced
Java Faqs useful for freshers and experiencedJava Faqs useful for freshers and experienced
Java Faqs useful for freshers and experienced
yearninginjava
 
Top 371 java fa qs useful for freshers and experienced
Top 371 java fa qs useful for freshers and experiencedTop 371 java fa qs useful for freshers and experienced
Top 371 java fa qs useful for freshers and experienced
Gaurav Maheshwari
 
Presentation2.ppt java basic core ppt .
Presentation2.ppt  java basic core ppt .Presentation2.ppt  java basic core ppt .
Presentation2.ppt java basic core ppt .
KeshavMotivation
 
JAVA VIVA QUESTIONS_CODERS LODGE.pdf
JAVA VIVA QUESTIONS_CODERS LODGE.pdfJAVA VIVA QUESTIONS_CODERS LODGE.pdf
JAVA VIVA QUESTIONS_CODERS LODGE.pdf
nofakeNews
 
1669617800196.pdf
1669617800196.pdf1669617800196.pdf
1669617800196.pdf
venud11
 
Nitish Chaulagai Java1.pptx
Nitish Chaulagai Java1.pptxNitish Chaulagai Java1.pptx
Nitish Chaulagai Java1.pptx
NitishChaulagai
 
Java questions for interview
Java questions for interviewJava questions for interview
Java questions for interview
Kuntal Bhowmick
 
Top 30 Java Phone Interview Questions Answers for Freshers, 1 to 2 Years Expe...
Top 30 Java Phone Interview Questions Answers for Freshers, 1 to 2 Years Expe...Top 30 Java Phone Interview Questions Answers for Freshers, 1 to 2 Years Expe...
Top 30 Java Phone Interview Questions Answers for Freshers, 1 to 2 Years Expe...
SynergisticMedia
 
Core Java Interview Questions PDF By ScholarHat
Core Java Interview Questions PDF By ScholarHatCore Java Interview Questions PDF By ScholarHat
Core Java Interview Questions PDF By ScholarHat
Scholarhat
 
25 java interview questions
25 java interview questions25 java interview questions
25 java interview questions
Mehtaacademy
 
Java Basics Presentation
Java Basics PresentationJava Basics Presentation
Java Basics Presentation
Omid Sohrabi
 
20 most important java programming interview questions
20 most important java programming interview questions20 most important java programming interview questions
20 most important java programming interview questions
Gradeup
 
Ad

More from zynofustechnology (13)

JAVA QUESTIONS -6
JAVA QUESTIONS -6JAVA QUESTIONS -6
JAVA QUESTIONS -6
zynofustechnology
 
JAVA QUESTIONS FOR INTERVIEW-3
JAVA QUESTIONS FOR INTERVIEW-3JAVA QUESTIONS FOR INTERVIEW-3
JAVA QUESTIONS FOR INTERVIEW-3
zynofustechnology
 
PYTHON INTERVIEW QUESTIONS-4
PYTHON INTERVIEW QUESTIONS-4PYTHON INTERVIEW QUESTIONS-4
PYTHON INTERVIEW QUESTIONS-4
zynofustechnology
 
PYTHON INTERVIEW QUESTIONS-2
PYTHON INTERVIEW QUESTIONS-2PYTHON INTERVIEW QUESTIONS-2
PYTHON INTERVIEW QUESTIONS-2
zynofustechnology
 
JAVA INTERVIEW QUESTIONS -3
JAVA INTERVIEW QUESTIONS -3JAVA INTERVIEW QUESTIONS -3
JAVA INTERVIEW QUESTIONS -3
zynofustechnology
 
Java Interview Questions-5
Java Interview Questions-5Java Interview Questions-5
Java Interview Questions-5
zynofustechnology
 
Java Interview Questions - 1
Java Interview Questions - 1Java Interview Questions - 1
Java Interview Questions - 1
zynofustechnology
 
Software Testing Interview Questions For Experienced
Software Testing Interview Questions For ExperiencedSoftware Testing Interview Questions For Experienced
Software Testing Interview Questions For Experienced
zynofustechnology
 
Python Interview Questions For Freshers
Python Interview Questions For FreshersPython Interview Questions For Freshers
Python Interview Questions For Freshers
zynofustechnology
 
HR interview questions
HR interview questionsHR interview questions
HR interview questions
zynofustechnology
 
Digital marketing questions -3
Digital marketing questions -3Digital marketing questions -3
Digital marketing questions -3
zynofustechnology
 
Digital marketing questions -2
Digital marketing questions -2Digital marketing questions -2
Digital marketing questions -2
zynofustechnology
 
Digital marketing questions 1
Digital marketing questions  1Digital marketing questions  1
Digital marketing questions 1
zynofustechnology
 
JAVA QUESTIONS FOR INTERVIEW-3
JAVA QUESTIONS FOR INTERVIEW-3JAVA QUESTIONS FOR INTERVIEW-3
JAVA QUESTIONS FOR INTERVIEW-3
zynofustechnology
 
PYTHON INTERVIEW QUESTIONS-4
PYTHON INTERVIEW QUESTIONS-4PYTHON INTERVIEW QUESTIONS-4
PYTHON INTERVIEW QUESTIONS-4
zynofustechnology
 
PYTHON INTERVIEW QUESTIONS-2
PYTHON INTERVIEW QUESTIONS-2PYTHON INTERVIEW QUESTIONS-2
PYTHON INTERVIEW QUESTIONS-2
zynofustechnology
 
Java Interview Questions - 1
Java Interview Questions - 1Java Interview Questions - 1
Java Interview Questions - 1
zynofustechnology
 
Software Testing Interview Questions For Experienced
Software Testing Interview Questions For ExperiencedSoftware Testing Interview Questions For Experienced
Software Testing Interview Questions For Experienced
zynofustechnology
 
Python Interview Questions For Freshers
Python Interview Questions For FreshersPython Interview Questions For Freshers
Python Interview Questions For Freshers
zynofustechnology
 
Digital marketing questions -3
Digital marketing questions -3Digital marketing questions -3
Digital marketing questions -3
zynofustechnology
 
Digital marketing questions -2
Digital marketing questions -2Digital marketing questions -2
Digital marketing questions -2
zynofustechnology
 
Digital marketing questions 1
Digital marketing questions  1Digital marketing questions  1
Digital marketing questions 1
zynofustechnology
 
Ad

Recently uploaded (20)

Slide share PPT of SOx control technologies.pptx
Slide share PPT of SOx control technologies.pptxSlide share PPT of SOx control technologies.pptx
Slide share PPT of SOx control technologies.pptx
vvsasane
 
Artificial intelligence and machine learning.pptx
Artificial intelligence and machine learning.pptxArtificial intelligence and machine learning.pptx
Artificial intelligence and machine learning.pptx
rakshanatarajan005
 
sss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptx
sss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptx
sss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptx
ajayrm685
 
Novel Plug Flow Reactor with Recycle For Growth Control
Novel Plug Flow Reactor with Recycle For Growth ControlNovel Plug Flow Reactor with Recycle For Growth Control
Novel Plug Flow Reactor with Recycle For Growth Control
Chris Harding
 
Design of Variable Depth Single-Span Post.pdf
Design of Variable Depth Single-Span Post.pdfDesign of Variable Depth Single-Span Post.pdf
Design of Variable Depth Single-Span Post.pdf
Kamel Farid
 
Dynamics of Structures with Uncertain Properties.pptx
Dynamics of Structures with Uncertain Properties.pptxDynamics of Structures with Uncertain Properties.pptx
Dynamics of Structures with Uncertain Properties.pptx
University of Glasgow
 
introduction technology technology tec.pptx
introduction technology technology tec.pptxintroduction technology technology tec.pptx
introduction technology technology tec.pptx
Iftikhar70
 
DED KOMINFO detail engginering design gedung
DED KOMINFO detail engginering design gedungDED KOMINFO detail engginering design gedung
DED KOMINFO detail engginering design gedung
nabilarizqifadhilah1
 
Routing Riverdale - A New Bus Connection
Routing Riverdale - A New Bus ConnectionRouting Riverdale - A New Bus Connection
Routing Riverdale - A New Bus Connection
jzb7232
 
Agents chapter of Artificial intelligence
Agents chapter of Artificial intelligenceAgents chapter of Artificial intelligence
Agents chapter of Artificial intelligence
DebdeepMukherjee9
 
ATAL 6 Days Online FDP Scheme Document 2025-26.pdf
ATAL 6 Days Online FDP Scheme Document 2025-26.pdfATAL 6 Days Online FDP Scheme Document 2025-26.pdf
ATAL 6 Days Online FDP Scheme Document 2025-26.pdf
ssuserda39791
 
Interfacing PMW3901 Optical Flow Sensor with ESP32
Interfacing PMW3901 Optical Flow Sensor with ESP32Interfacing PMW3901 Optical Flow Sensor with ESP32
Interfacing PMW3901 Optical Flow Sensor with ESP32
CircuitDigest
 
How to Buy Snapchat Account A Step-by-Step Guide.pdf
How to Buy Snapchat Account A Step-by-Step Guide.pdfHow to Buy Snapchat Account A Step-by-Step Guide.pdf
How to Buy Snapchat Account A Step-by-Step Guide.pdf
jamedlimmk
 
Evonik Overview Visiomer Specialty Methacrylates.pdf
Evonik Overview Visiomer Specialty Methacrylates.pdfEvonik Overview Visiomer Specialty Methacrylates.pdf
Evonik Overview Visiomer Specialty Methacrylates.pdf
szhang13
 
SICPA: Fabien Keller - background introduction
SICPA: Fabien Keller - background introductionSICPA: Fabien Keller - background introduction
SICPA: Fabien Keller - background introduction
fabienklr
 
A Survey of Personalized Large Language Models.pptx
A Survey of Personalized Large Language Models.pptxA Survey of Personalized Large Language Models.pptx
A Survey of Personalized Large Language Models.pptx
rutujabhaskarraopati
 
Water Industry Process Automation & Control Monthly May 2025
Water Industry Process Automation & Control Monthly May 2025Water Industry Process Automation & Control Monthly May 2025
Water Industry Process Automation & Control Monthly May 2025
Water Industry Process Automation & Control
 
Understanding Structural Loads and Load Paths
Understanding Structural Loads and Load PathsUnderstanding Structural Loads and Load Paths
Understanding Structural Loads and Load Paths
University of Kirkuk
 
Building-Services-Introduction-Notes.pdf
Building-Services-Introduction-Notes.pdfBuilding-Services-Introduction-Notes.pdf
Building-Services-Introduction-Notes.pdf
Lawrence Omai
 
Applications of Centroid in Structural Engineering
Applications of Centroid in Structural EngineeringApplications of Centroid in Structural Engineering
Applications of Centroid in Structural Engineering
suvrojyotihalder2006
 
Slide share PPT of SOx control technologies.pptx
Slide share PPT of SOx control technologies.pptxSlide share PPT of SOx control technologies.pptx
Slide share PPT of SOx control technologies.pptx
vvsasane
 
Artificial intelligence and machine learning.pptx
Artificial intelligence and machine learning.pptxArtificial intelligence and machine learning.pptx
Artificial intelligence and machine learning.pptx
rakshanatarajan005
 
sss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptx
sss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptx
sss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptx
ajayrm685
 
Novel Plug Flow Reactor with Recycle For Growth Control
Novel Plug Flow Reactor with Recycle For Growth ControlNovel Plug Flow Reactor with Recycle For Growth Control
Novel Plug Flow Reactor with Recycle For Growth Control
Chris Harding
 
Design of Variable Depth Single-Span Post.pdf
Design of Variable Depth Single-Span Post.pdfDesign of Variable Depth Single-Span Post.pdf
Design of Variable Depth Single-Span Post.pdf
Kamel Farid
 
Dynamics of Structures with Uncertain Properties.pptx
Dynamics of Structures with Uncertain Properties.pptxDynamics of Structures with Uncertain Properties.pptx
Dynamics of Structures with Uncertain Properties.pptx
University of Glasgow
 
introduction technology technology tec.pptx
introduction technology technology tec.pptxintroduction technology technology tec.pptx
introduction technology technology tec.pptx
Iftikhar70
 
DED KOMINFO detail engginering design gedung
DED KOMINFO detail engginering design gedungDED KOMINFO detail engginering design gedung
DED KOMINFO detail engginering design gedung
nabilarizqifadhilah1
 
Routing Riverdale - A New Bus Connection
Routing Riverdale - A New Bus ConnectionRouting Riverdale - A New Bus Connection
Routing Riverdale - A New Bus Connection
jzb7232
 
Agents chapter of Artificial intelligence
Agents chapter of Artificial intelligenceAgents chapter of Artificial intelligence
Agents chapter of Artificial intelligence
DebdeepMukherjee9
 
ATAL 6 Days Online FDP Scheme Document 2025-26.pdf
ATAL 6 Days Online FDP Scheme Document 2025-26.pdfATAL 6 Days Online FDP Scheme Document 2025-26.pdf
ATAL 6 Days Online FDP Scheme Document 2025-26.pdf
ssuserda39791
 
Interfacing PMW3901 Optical Flow Sensor with ESP32
Interfacing PMW3901 Optical Flow Sensor with ESP32Interfacing PMW3901 Optical Flow Sensor with ESP32
Interfacing PMW3901 Optical Flow Sensor with ESP32
CircuitDigest
 
How to Buy Snapchat Account A Step-by-Step Guide.pdf
How to Buy Snapchat Account A Step-by-Step Guide.pdfHow to Buy Snapchat Account A Step-by-Step Guide.pdf
How to Buy Snapchat Account A Step-by-Step Guide.pdf
jamedlimmk
 
Evonik Overview Visiomer Specialty Methacrylates.pdf
Evonik Overview Visiomer Specialty Methacrylates.pdfEvonik Overview Visiomer Specialty Methacrylates.pdf
Evonik Overview Visiomer Specialty Methacrylates.pdf
szhang13
 
SICPA: Fabien Keller - background introduction
SICPA: Fabien Keller - background introductionSICPA: Fabien Keller - background introduction
SICPA: Fabien Keller - background introduction
fabienklr
 
A Survey of Personalized Large Language Models.pptx
A Survey of Personalized Large Language Models.pptxA Survey of Personalized Large Language Models.pptx
A Survey of Personalized Large Language Models.pptx
rutujabhaskarraopati
 
Understanding Structural Loads and Load Paths
Understanding Structural Loads and Load PathsUnderstanding Structural Loads and Load Paths
Understanding Structural Loads and Load Paths
University of Kirkuk
 
Building-Services-Introduction-Notes.pdf
Building-Services-Introduction-Notes.pdfBuilding-Services-Introduction-Notes.pdf
Building-Services-Introduction-Notes.pdf
Lawrence Omai
 
Applications of Centroid in Structural Engineering
Applications of Centroid in Structural EngineeringApplications of Centroid in Structural Engineering
Applications of Centroid in Structural Engineering
suvrojyotihalder2006
 

Java Interview Questions For Freshers

  • 1. JAVA INTERVIEW QUESTIONS FOR FRESHERS Why Java is platform independent? Java is called platform independent because of its byte codes which can run on any system irrespective of its underlying operating system. Why Java is not 100%Object-oriented? Java is not 100% Object-oriented becauseit makes use of eight primitive data types such as boolean, byte, char, int, float, double, long, short which are not objects. What are constructors in Java? In Java, constructorrefers to a block of codewhich is used to initialize an object. It must have the same name as that of the class. Also, it has no return type and it is automatically called when an object is created. There are two types of constructors: 1. Default Constructor: In Java, a default constructoris the one which does not take any inputs. In other words, default constructors are the no argument constructors which will be created by default in case you no other constructoris defined by the user. Its main purposeis to initialize the instance variables with the default values. Also, it is majorly used for object creation. 2. ParameterizedConstructor: The parameterized constructorin Java, is the constructorwhich is capable of initializing the instance variables with the provided values. In other words, the constructors which take the arguments are called parameterized constructors. Why pointers are not used in Java? Java doesn’tuse pointers because they are unsafe and increases the complexity of the program. Since, Java is known for its simplicity of code, adding the conceptof pointers will be contradicting. Moreover, since JVM is responsible for implicit memory allocation, thus in order to avoid direct access to memory by the user, pointers are discouraged in Java.
  • 2. What is the difference between an array and an array list? Array ArrayList Cannot contain values of different data types Can contain values of different data types. Size must be defined at the time of declaration Size can be dynamically changed Need to specify the index in order to add data No need to specify the index Arrays are not type parameterized Arraylists are type Arrays can contain primitive data types as well as objects Arraylists can contain only objects, no primitive data types are allowed What is a Map in Java? In Java, Map is an interface of Util package which maps unique keys to values. The Map interface is not a subset of the main Collection interface and thus it behaves little different from the other collection types. Below are a few of the characteristics of Map interface: 1. Map doesn’tcontain duplicate keys. 2. Each key can map at max one value. What is a classloaderin Java? The Java ClassLoader is a subsetof JVM (Java Virtual Machine) that is responsible for loading the class files. Whenever a Java program is executed it is first loaded by the classloader. Java provides three built-in classloaders: 1. Bootstrap ClassLoader 2. Extension ClassLoader 3. System/Application ClassLoader
  • 3. What are access modifiers in Java? In Java, access modifiers are special keywords which are used to restrict the access of a class, constructor, data member and method in another class. Java supports four types of access modifiers: 1. Default 2. Private 3. Protected 4. Public Define a Java Class. A class in Java is a blueprint which includes all your data. A class contains fields (variables) and methods to describe the behavior of an object. Let’s have a look at the syntax of a class. 1 2 3 class Abc { member variables // class body methods} What is an objectin Java and how is it created? An object is a real-world entity that has a state and behavior. An object has three characteristics: 1. State 2. Behavior 3. Identity An object is created using the ‘new’ keyword. For example: ClassName obj= new ClassName();
  • 4. OOPS Java Interview Questions What is run time polymorphism and compile time polymorphism? Compile time polymorphism is method overloading whereas Runtime time polymorphism is done using inheritance and interface. In Java, runtime polymorphism or dynamic method dispatch is a process in which a call to an overridden method is resolved at runtime rather than at compile-time. In this process, an overridden method is called through the reference variable of a superclass. Let’s take a look at the example below to understand it better. What is abstractionin Java? Abstraction refers to the quality of dealing with ideas rather than events. It basically deals with hiding the details and showing the essential things to the user. Thus you can say that abstraction in Java is the process ofhiding the implementation details from the user and revealing only the functionality to them. Abstraction can be achieved in two ways: 1. Abstract Classes (0-100% of abstraction can be achieved) 2. Interfaces (100% of abstraction can be achieved) What do you mean by an interface in Java? An interface in Java is a blueprint of a class or you can say it is a collection of abstract methods and static constants. In an interface, each method is public and abstract but it does not contain any constructor. Thus, interface basically is a group of related methods with empty bodies. Example: public interface Animal { public void eat(); public void sleep(); public void run(); }
  • 5. What is inheritance in Java? Inheritance in Java is the conceptwhere the properties of one class can be inherited by the other. It helps to reuse the codeand establish a relationship between different classes. Inheritance is performed between two types of classes: 1. Parent class (Super or Base class) 2. Child class (Subclass or Derived class) A class which inherits the properties is known as Child Class whereas a class whose properties are inherited is known as Parent class. What are the different types of inheritance in Java? Java supports four types of inheritance which are: 1. Single Inheritance: In single inheritance, one class inherits the properties of another i.e there will be only one parent as well as one child class. 2. Multilevel Inheritance: When a class is derived from a class which is also derived from another class, i.e. a class having more than one parent class but at different levels, such type of inheritance is called Multilevel Inheritance. 3. HierarchicalInheritance: When a class has more than one child classes (subclasses)or in other words, more than one child classes have the same parent class, then such kind of inheritance is known as hierarchical. 4. Hybrid Inheritance: Hybrid inheritance is a combination of two or more types of inheritance. What is method overloading and method overriding? Method Overloading :  In Method Overloading, Methods of the same class shares the same name but each method must have a different number of parameters or parameters having different types and order.  Method Overloading is to “add”or “extend” more to the method’s behavior.  It is a compile-time polymorphism.  The methods must have a different signature.  It may or may not need inheritance in Method Overloading.
  • 6. Method Overriding:  In Method Overriding, the subclass has the same method with the same name and exactly the same number and type of parameters and same return type as a superclass.  Method Overriding is to “Change” existing behavior of the method.  It is a run time polymorphism.  The methods must have the same signature.  It always requires inheritance in Method Overriding. What is multiple inheritance? Is it supported by Java? If a child class inherits the property from multiple classes is known as multiple inheritance. Java does not allow to extend multiple classes. The problem with multiple inheritance is that if multiple parent classes have the same method name, then at runtime it becomes difficult for the compiler to decide which method to execute from the child class. Therefore, Java doesn’tsupportmultiple inheritance. The problem is commonly referred to as Diamond Problem. In case you are facing any challenges with these java interview questions, please comment on your problems in the section below. What is encapsulationin Java? Encapsulation is a mechanism where you bind your data(variables) and code(methods)together as a single unit. Here, the data is hidden from the outer world and can be accessed only via current class methods. This helps in protecting the data from any unnecessary modification. We can achieve encapsulation in Java by:  Declaring the variables of a class as private.  Providing public setter and getter methods to modify and view the values of the variables.
  • 7. Servlets – Java Interview Questions What is RequestDispatcher? RequestDispatcher interface is used to forward the request to another resource that can be HTML, JSP or another servlet in same application. We can also use this to include the content of another resource to the response. There are two methods defined in this interface: 1.void forward() 2.void include() What is the life-cycle of a servlet? There are 5 stages in the lifecycle of a servlet: 1. Servlet is loaded 2. Servlet is instantiated 3. Servlet is initialized 4. Service the request 5. Servlet is destroyed . What are the different methods of sessionmanagementin servlets? Some of the common ways of session management in servlets are: 1. User Authentication 2. HTML Hidden Field 3. Cookies 4. URL Rewriting 5. Session Management API
  • 8. JDBC – Java Interview Questions What is JDBC Driver? JDBC Driver is a software componentthat enables java application to interact with the database. There are 4 types of JDBC drivers: 1. JDBC-ODBC bridge driver 2. Native-API driver (partially java driver) 3. Network Protocoldriver (fully java driver) 4. Thin driver (fully java driver) What are the JDBC API components? The java.sql package contains interfaces and classes for JDBC API. Interfaces:  Connection  Statement  PreparedStatement  ResultSet  ResultSetMetaData  DatabaseMetaData  CallableStatement etc. Classes:  DriverManager  Blob  Clob  Types  SQLException etc.
  • 9. What is the role of JDBC DriverManagerclass? The DriverManager class manages the registered drivers. It can be used to register and unregister drivers. It provides factory method that returns the instance of Connection. What is JDBC Connectioninterface? The Connection interface maintains a sessionwith the database. It can be used for transaction management. It provides factory methods that returns the instance of Statement, PreparedStatement, CallableStatement and DatabaseMetaData. What are the steps to connectto a database in java?  Registering the driver class  Creating connection  Creating statement  Executing queries  Closing connection What is JDBC DatabaseMetaDatainterface? The DatabaseMetaData interface returns the information of the database such as username, driver name, driver version, number of tables, number of views etc. Spring Framework – Java Interview Questions List some of the important annotations in annotation-basedSpring configuration. The important annotations are:  @Required  @Autowired  @Qualifier  @Resource  @PostConstruct  @PreDestroy
  • 10. What is autowiring in Spring? What are the autowiring modes? Autowiring enables the programmer to inject the bean automatically. We don’t need to write explicit injection logic. The autowiring modes are given below: No, by name, by type, constructor Name the types of transactionmanagement that Spring supports. Programmatic transaction management Declarative transaction management JSP – Java Interview Questions What are the different tags provided in JSTL? There are 5 type of JSTL tags. 1. core tags 2. sqltags 3. xml tags 4. internationalization tags 5. functions tags How to disable sessionin JSP? 1. <%@ page session=“false” %> Exception and Thread Java Interview Questions How can you handle Java exceptions? There are five keywords used to handle exceptions in Java: 1. try 2. catch 3. finally 4. throw 5. throws
  • 11. What are the important methods of Java Exception Class? String getMessage() String getLocalizedMessage() Synchronized Throwable getCause() String toString() void printStackTrace() What is OutOfMemoryError in Java? OutOfMemoryError is the subclass of java.lang.Error which generally occurs when our JVM runs out of memory. What are the two ways to create a thread? In Java, threads can be created in the following two ways:-  By implementing the Runnable interface.  By extending the Thread
  翻译: