SlideShare a Scribd company logo
1 of 3
www.p2cinfotech.com

Ph: +1-732-546-3607

JAVA INTERVIEW QUESTIONS AND ANSWERS
What is the difference between procedural and object-oriented programs?
1) In procedural program, programming logic follows certain procedures and the
instructions are executed one after another. In OOP program, unit of program is object,
which is nothing but combination of data and code.
2) In procedural program, data is exposed to the whole program whereas in OOPs
program, it is accessible with in the object and which in turn assures the security of the
code.
What is the difference between Assignment and Initialization?
Assignment can be done as many times as desired whereas initialization can be done
only once.
What is the difference between constructor and method?
Constructor will be automatically invoked when an object is created whereas method has
to be called explicitly.
What is the difference between an argument and a parameter?
While defining method, variables passed in the method are called parameters. While using
those methods, values passed to those variables are called arguments.
What is the difference between overloading and overriding?
1) In overloading, there is a relationship between methods available in the same class
whereas in overriding, there is relationship between a super class method and subclass
method.
2) Overloading does not block inheritance from the super class whereas overriding blocks
inheritance from the super class.
3) In overloading, separate methods share the same name whereas in overriding,
subclass method replaces the super class.
4) Overloading must have different method signatures whereas overriding must have
same signature.
www.prepareinterview.com
What is the difference between this () and super ()?
This () can be used to invoke a constructor of the same class whereas super () can be
used to invoke a super class constructor.
What is the difference between super class and sub class?
A super class is a class that is inherited whereas sub class is a class that does the
inheriting.
What is the difference between String and String Buffer?
1) String objects are constants and immutable whereas String Buffer objects are not.
www.p2cinfotech.com

Ph: +1-732-546-3607

2) String class supports constant strings whereas String Buffer class supports growable
and modifiable strings.
What is the difference between Array and vector?
Array is a set of related data type and static whereas vector is a growable array of objects
and dynamic.
What is the difference between exception and error?
The exception class defines mild error conditions that your program encounters.
Exceptions can occur when trying to open the file, which does not exist, the network
connection is disrupted, operands being manipulated are out of prescribed ranges, the
class file you are interested in loading is missing. The error class defines serious error
conditions that you should not attempt to recover from. In most cases it is advisable to
let the program terminate when such an error is encountered.
What is the difference between process and thread?
Process is a program in execution whereas thread is a separate path of execution in a
program.
What is the difference between abstract class and interface?
1) All the methods declared inside an interface are abstract whereas abstract class must
have at least one abstract method and others may be concrete or abstract.
2) In abstract class, key word abstract must be used for the methods whereas interface
we need not use that keyword for the methods.
3) Abstract class must have subclasses whereas interface can’t have subclasses.
What is the difference between Integer and int?
1) Integer is a class defined in the java. lang package, whereas int is a primitive data
type defined in the Java language itself. Java does not automatically convert from one to
the other.
2) Integer can be used as an argument for a method that requires an object, whereas int
can be used for calculations.
What is the difference between choice and list?
A Choice is displayed in a compact form that requires you to pull it down to see the list of
available choices and only one item may be selected from a choice. A List may be
displayed in such a way that several list items are visible and it supports the selection of
one or more list items.
What is the difference between scrollbar and scrollpane?
A Scrollbar is a Component, but not a Container whereas scrollpane is a conatiner and
handles its own events and perform its own scrolling.
What is the difference between applications and applets?
1) Application must be run on local machine whereas applet needs no explicit installation
on local machine.
2) Application must be run explicitly within a java-compatible virtual machine whereas
applet loads and runs itself automatically in a java-enabled browser.
3) Application starts execution with its main method whereas applet starts execution with
www.p2cinfotech.com

Ph: +1-732-546-3607

its init method.
4) Application can run with or without graphical user interface whereas applet must run
within a graphical user interface.
What is the difference between set and list?
Set stores elements in an unordered way but does not contain duplicate elements,
whereas list stores elements in an ordered way but may contain duplicate elements.
What is the difference between an applet and a servlet?
1) Servlets are to servers what applets are to browsers.
2) Applets must have graphical user interfaces whereas servlets have no graphical user
interfaces.
What is the difference between doPost and doGet methods?
1) doGet() method is used to get information, while doPost() method is used for posting
information.
2) doGet() requests can’t send large amount of information and is limited to 240-255
characters. However, doPost()requests passes all of its data, of unlimited length.
3) A doGet() request is appended to the request URL in a query string and this allows the
exchange is visible to the client, whereas a doPost() request passes directly over the
socket connection as part of its HTTP request body and the exchange are invisible to the
client.
What is the difference between TCP/IP and UDP?
TCP/IP is a two-way communication between the client and the server and it
is a reliable and there is a confirmation regarding reaching the message to the
destination. It is like a phone call.
UDP is a one-way communication only between the client and the server and it
is not a reliable and there is no confirmation regarding reaching the message to the
destination. It is like a postal mail.

DEATAILS:
Website: www.p2cinfotech.com
Email: training@p2cinfotech.com
Phone: +1-732-546-3607

More Related Content

What's hot

201 core java interview questions oo ps interview questions - javatpoint
201 core java interview questions   oo ps interview questions - javatpoint201 core java interview questions   oo ps interview questions - javatpoint
201 core java interview questions oo ps interview questions - javatpoint
ravi tyagi
 
Core java interview questions1
Core java interview questions1Core java interview questions1
Core java interview questions1
Lahari Reddy
 
JAVA VIVA QUESTIONS_CODERS LODGE.pdf
JAVA VIVA QUESTIONS_CODERS LODGE.pdfJAVA VIVA QUESTIONS_CODERS LODGE.pdf
JAVA VIVA QUESTIONS_CODERS LODGE.pdf
nofakeNews
 
Core java interview faq
Core java interview faqCore java interview faq
Core java interview faq
Kumaran K
 

What's hot (19)

Java/J2EE interview Qestions
Java/J2EE interview QestionsJava/J2EE interview Qestions
Java/J2EE interview Qestions
 
201 core java interview questions oo ps interview questions - javatpoint
201 core java interview questions   oo ps interview questions - javatpoint201 core java interview questions   oo ps interview questions - javatpoint
201 core java interview questions oo ps interview questions - javatpoint
 
Core java questions
Core java questionsCore java questions
Core java questions
 
Java questions for interview
Java questions for interviewJava questions for interview
Java questions for interview
 
37 Java Interview Questions
37 Java Interview Questions37 Java Interview Questions
37 Java Interview Questions
 
Java interview questions 1
Java interview questions 1Java interview questions 1
Java interview questions 1
 
C# interview quesions
C# interview quesionsC# interview quesions
C# interview quesions
 
Object+oriented+programming+in+java
Object+oriented+programming+in+javaObject+oriented+programming+in+java
Object+oriented+programming+in+java
 
C# interview questions
C# interview questionsC# interview questions
C# interview questions
 
C#
C#C#
C#
 
Top 20 c# interview Question and answers
Top 20 c# interview Question and answersTop 20 c# interview Question and answers
Top 20 c# interview Question and answers
 
Class notes(week 9) on multithreading
Class notes(week 9) on multithreadingClass notes(week 9) on multithreading
Class notes(week 9) on multithreading
 
Core java interview questions1
Core java interview questions1Core java interview questions1
Core java interview questions1
 
JAVA VIVA QUESTIONS_CODERS LODGE.pdf
JAVA VIVA QUESTIONS_CODERS LODGE.pdfJAVA VIVA QUESTIONS_CODERS LODGE.pdf
JAVA VIVA QUESTIONS_CODERS LODGE.pdf
 
Core java interview faq
Core java interview faqCore java interview faq
Core java interview faq
 
Object Oriented Programing JAVA presentaion
Object Oriented Programing JAVA presentaionObject Oriented Programing JAVA presentaion
Object Oriented Programing JAVA presentaion
 
Suga java training_with_footer
Suga java training_with_footerSuga java training_with_footer
Suga java training_with_footer
 
Java Concurrency Starter Kit
Java Concurrency Starter KitJava Concurrency Starter Kit
Java Concurrency Starter Kit
 
Java Interview Questions by NageswaraRao
Java Interview Questions by NageswaraRaoJava Interview Questions by NageswaraRao
Java Interview Questions by NageswaraRao
 

Similar to Interview Questions and Answers for Java

Java interview faq's
Java interview faq'sJava interview faq's
Java interview faq's
Deepak Raj
 
Javainterviewquestions 110607071413-phpapp02
Javainterviewquestions 110607071413-phpapp02Javainterviewquestions 110607071413-phpapp02
Javainterviewquestions 110607071413-phpapp02
Kumaran K
 
Javainterviewquestions 110607071413-phpapp02
Javainterviewquestions 110607071413-phpapp02Javainterviewquestions 110607071413-phpapp02
Javainterviewquestions 110607071413-phpapp02
lakk1234
 

Similar to Interview Questions and Answers for Java (20)

Java interview questions and answers
Java interview questions and answersJava interview questions and answers
Java interview questions and answers
 
Java interview faq's
Java interview faq'sJava interview faq's
Java interview faq's
 
Java interview questions
Java interview questionsJava interview questions
Java interview questions
 
Intervies
InterviesIntervies
Intervies
 
Javainterview
JavainterviewJavainterview
Javainterview
 
Data Structure Interview Questions & Answers
Data Structure Interview Questions & AnswersData Structure Interview Questions & Answers
Data Structure Interview Questions & Answers
 
Core_Java_Interview.pdf
Core_Java_Interview.pdfCore_Java_Interview.pdf
Core_Java_Interview.pdf
 
Technical_Interview_Questions.pdf
Technical_Interview_Questions.pdfTechnical_Interview_Questions.pdf
Technical_Interview_Questions.pdf
 
Java J2EE Interview Questions Part-1
Java J2EE Interview Questions Part-1Java J2EE Interview Questions Part-1
Java J2EE Interview Questions Part-1
 
Java J2EE Interview Questions Part-1
Java J2EE Interview Questions Part-1Java J2EE Interview Questions Part-1
Java J2EE Interview Questions Part-1
 
Java faq's
Java faq'sJava faq's
Java faq's
 
Tcs NQTExam technical questions
Tcs NQTExam technical questionsTcs NQTExam technical questions
Tcs NQTExam technical questions
 
Core java interview questions
Core java interview questionsCore java interview questions
Core java interview questions
 
C language 100 questions answers
C language 100 questions answersC language 100 questions answers
C language 100 questions answers
 
Java interview question
Java interview questionJava interview question
Java interview question
 
M.c.a. (sem iv)- java programming
M.c.a. (sem   iv)- java programmingM.c.a. (sem   iv)- java programming
M.c.a. (sem iv)- java programming
 
Javainterviewquestions 110607071413-phpapp02
Javainterviewquestions 110607071413-phpapp02Javainterviewquestions 110607071413-phpapp02
Javainterviewquestions 110607071413-phpapp02
 
Javainterviewquestions 110607071413-phpapp02
Javainterviewquestions 110607071413-phpapp02Javainterviewquestions 110607071413-phpapp02
Javainterviewquestions 110607071413-phpapp02
 
Faqs in java
Faqs in javaFaqs in java
Faqs in java
 
C# interview
C# interviewC# interview
C# interview
 

More from Garuda Trainings

Software development life cycle
Software development life cycleSoftware development life cycle
Software development life cycle
Garuda Trainings
 
Dot net Online Training | .Net Training and Placement online
Dot net Online Training | .Net Training and Placement onlineDot net Online Training | .Net Training and Placement online
Dot net Online Training | .Net Training and Placement online
Garuda Trainings
 

More from Garuda Trainings (14)

SAP BI 7.0 Info Providers
SAP BI 7.0 Info ProvidersSAP BI 7.0 Info Providers
SAP BI 7.0 Info Providers
 
Short definitions of all testing types
Short definitions of all testing typesShort definitions of all testing types
Short definitions of all testing types
 
Software testing life cycle
Software testing life cycleSoftware testing life cycle
Software testing life cycle
 
Fundamental classes in java
Fundamental classes in javaFundamental classes in java
Fundamental classes in java
 
Java Exception handling
Java Exception handlingJava Exception handling
Java Exception handling
 
Performance testing interview questions and answers
Performance testing interview questions and answersPerformance testing interview questions and answers
Performance testing interview questions and answers
 
Loadrunner interview questions and answers
Loadrunner interview questions and answersLoadrunner interview questions and answers
Loadrunner interview questions and answers
 
Business analysis interview question and answers
Business analysis interview question and answersBusiness analysis interview question and answers
Business analysis interview question and answers
 
Quality center interview questions and answers
Quality center interview questions and answersQuality center interview questions and answers
Quality center interview questions and answers
 
Software development life cycle
Software development life cycleSoftware development life cycle
Software development life cycle
 
Dot net Online Training | .Net Training and Placement online
Dot net Online Training | .Net Training and Placement onlineDot net Online Training | .Net Training and Placement online
Dot net Online Training | .Net Training and Placement online
 
Interview questions and answers for quality assurance
Interview questions and answers for quality assuranceInterview questions and answers for quality assurance
Interview questions and answers for quality assurance
 
Unix commands in etl testing
Unix commands in etl testingUnix commands in etl testing
Unix commands in etl testing
 
SQL for ETL Testing
SQL for ETL TestingSQL for ETL Testing
SQL for ETL Testing
 

Recently uploaded

Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 

Recently uploaded (20)

ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 

Interview Questions and Answers for Java

  • 1. www.p2cinfotech.com Ph: +1-732-546-3607 JAVA INTERVIEW QUESTIONS AND ANSWERS What is the difference between procedural and object-oriented programs? 1) In procedural program, programming logic follows certain procedures and the instructions are executed one after another. In OOP program, unit of program is object, which is nothing but combination of data and code. 2) In procedural program, data is exposed to the whole program whereas in OOPs program, it is accessible with in the object and which in turn assures the security of the code. What is the difference between Assignment and Initialization? Assignment can be done as many times as desired whereas initialization can be done only once. What is the difference between constructor and method? Constructor will be automatically invoked when an object is created whereas method has to be called explicitly. What is the difference between an argument and a parameter? While defining method, variables passed in the method are called parameters. While using those methods, values passed to those variables are called arguments. What is the difference between overloading and overriding? 1) In overloading, there is a relationship between methods available in the same class whereas in overriding, there is relationship between a super class method and subclass method. 2) Overloading does not block inheritance from the super class whereas overriding blocks inheritance from the super class. 3) In overloading, separate methods share the same name whereas in overriding, subclass method replaces the super class. 4) Overloading must have different method signatures whereas overriding must have same signature. www.prepareinterview.com What is the difference between this () and super ()? This () can be used to invoke a constructor of the same class whereas super () can be used to invoke a super class constructor. What is the difference between super class and sub class? A super class is a class that is inherited whereas sub class is a class that does the inheriting. What is the difference between String and String Buffer? 1) String objects are constants and immutable whereas String Buffer objects are not.
  • 2. www.p2cinfotech.com Ph: +1-732-546-3607 2) String class supports constant strings whereas String Buffer class supports growable and modifiable strings. What is the difference between Array and vector? Array is a set of related data type and static whereas vector is a growable array of objects and dynamic. What is the difference between exception and error? The exception class defines mild error conditions that your program encounters. Exceptions can occur when trying to open the file, which does not exist, the network connection is disrupted, operands being manipulated are out of prescribed ranges, the class file you are interested in loading is missing. The error class defines serious error conditions that you should not attempt to recover from. In most cases it is advisable to let the program terminate when such an error is encountered. What is the difference between process and thread? Process is a program in execution whereas thread is a separate path of execution in a program. What is the difference between abstract class and interface? 1) All the methods declared inside an interface are abstract whereas abstract class must have at least one abstract method and others may be concrete or abstract. 2) In abstract class, key word abstract must be used for the methods whereas interface we need not use that keyword for the methods. 3) Abstract class must have subclasses whereas interface can’t have subclasses. What is the difference between Integer and int? 1) Integer is a class defined in the java. lang package, whereas int is a primitive data type defined in the Java language itself. Java does not automatically convert from one to the other. 2) Integer can be used as an argument for a method that requires an object, whereas int can be used for calculations. What is the difference between choice and list? A Choice is displayed in a compact form that requires you to pull it down to see the list of available choices and only one item may be selected from a choice. A List may be displayed in such a way that several list items are visible and it supports the selection of one or more list items. What is the difference between scrollbar and scrollpane? A Scrollbar is a Component, but not a Container whereas scrollpane is a conatiner and handles its own events and perform its own scrolling. What is the difference between applications and applets? 1) Application must be run on local machine whereas applet needs no explicit installation on local machine. 2) Application must be run explicitly within a java-compatible virtual machine whereas applet loads and runs itself automatically in a java-enabled browser. 3) Application starts execution with its main method whereas applet starts execution with
  • 3. www.p2cinfotech.com Ph: +1-732-546-3607 its init method. 4) Application can run with or without graphical user interface whereas applet must run within a graphical user interface. What is the difference between set and list? Set stores elements in an unordered way but does not contain duplicate elements, whereas list stores elements in an ordered way but may contain duplicate elements. What is the difference between an applet and a servlet? 1) Servlets are to servers what applets are to browsers. 2) Applets must have graphical user interfaces whereas servlets have no graphical user interfaces. What is the difference between doPost and doGet methods? 1) doGet() method is used to get information, while doPost() method is used for posting information. 2) doGet() requests can’t send large amount of information and is limited to 240-255 characters. However, doPost()requests passes all of its data, of unlimited length. 3) A doGet() request is appended to the request URL in a query string and this allows the exchange is visible to the client, whereas a doPost() request passes directly over the socket connection as part of its HTTP request body and the exchange are invisible to the client. What is the difference between TCP/IP and UDP? TCP/IP is a two-way communication between the client and the server and it is a reliable and there is a confirmation regarding reaching the message to the destination. It is like a phone call. UDP is a one-way communication only between the client and the server and it is not a reliable and there is no confirmation regarding reaching the message to the destination. It is like a postal mail. DEATAILS: Website: www.p2cinfotech.com Email: training@p2cinfotech.com Phone: +1-732-546-3607