SlideShare a Scribd company logo
1 of 4
Java Interview Questions and Answers for cognizant:
In this Java Interview Questions, I am going to list some of the most important
Java Interview Questions and Answers which will help you in the interview
process. Java is used by approximately 10 Million developers worldwide to develop
applications. It is also used to create applications for trending technologies like
Mobiles. And hence today, Java is used everywhere!
1. What do you understand by java?
 Java is an object-oriented computer language.
 Java is a fast, secure and reliable languageused for many games, devices
and applications.
2. What are the major Java features?
 Object-Oriented – java is based on object-oriented programming where the class and
methods describe about the state and behaviour of object.
 Portable – Java program gets converted into Java Byte Codes that can be executed
on any platform without any dependency.
 Platform independent – java works on “write once and run anywhere” as it supports
multiple platforms like Windows, Linux, Mac, Sun Solaris, etc.
 Robust – Java has a strong memory management as there is no pointer allocations. It
has automatic garbage collection that prohibits memory leaks.
 Interpreted – java compiler converts the codes into Java Byte Codes which are then
interpreted and executed by Java Interpreter.
2. What doyoumeanby Object?
 A Javaobject is a combinationof data andprocedures workingon the available data.
 Objects are created from templatesknownas classes. InJava, an object is created usingthe
keyword"new".
3. What is class inJava?
 A class is a user defined blueprint or prototype from which objects are created. It
represents the set of properties or methods that are common to all objects of one type.
4. What is JDK, JREand JVM?
 JVM stands for Java Virtual Machine which provides runtime environment for Java
Byte Codes to be executed.
 JRE stands for Java Runtime Environment that includes sets of files required by
JVM during runtime.
 JDK stands for Java Development Kit consists of JRE along with the development
tools required to write and execute a program.
5. Differentiate between String Buffer and String Builder in Java
programming?
 String Buffer in java is used to create modifiable String objects. This means
that we can use String Buffer to append, reverse, replace, concatenate and
manipulate Strings or sequence of characters.
 Java String Builder class is designed for use as a drop-in replacement for String
Buffer in places where the string buffer was being used by a single thread (as
is generally the case).
6. Difference between Array list And Vector?
 An array is nothing but a sequential collection same type of elements, accessed by
their index values.
 Java Array List uses an array as the internal programming construct to store
elements.
 Vectors in java just another kind of object, of type java.util.Vector.
7. Difference between the Inner Class and Sub Class?
 Inner class provides the access rights for the class which is nesting it and that can access all
variables and methods defined in the outer class.
 Sub-class provides access to all public and protected methods and fields of its super class.
8. Name the methods of Object Class?
 clone() – This method helps to create and return a copy of the object.
 equals() – This method helps to compare
 finalize() – Called by the garbage collector on an object
 getClass() – It helps to return the runtime class of an object.
 hashCode() – Helps to return a hash code value for the object.
 toString() – helps to return a string representation of the object.
 notify(), notifyAll(), and wait() – It helps to synchronize the activities of
independently running threads in a program.
9. What are Loops in Java? What are three types of loops?
 Looping is used in programming to execute a statement or a block of
statement repeatedly. There are three types of loops in Java:
1) For Loops
For loops are used in java to execute statements repeatedly for a given number
of times. For loops are used when number of times to execute the statements is
known to programmer.
2) While Loops
While loop is used when certain statements need to be executed repeatedly until
a condition is fulfilled. In while loops, condition is checked first before execution of
statements.
3) Do While Loops
Do While Loop is same as while loop with only differencethat condition is
checked after execution of block of statements. Hence in case of do while loop,
statements are executed at least once.
10. What is Final Keyword in Java? Give an example.
 In java, a constant is declared using the keyword Final. Value can be
assigned only once and after assignment, value of a constant can't be
changed.
In below example, a constant with the name const_val is declared and assigned
avalue:
Private Final int const_val=100 When a method is declared as final,it can NOT be
overridden by the subclasses.This method are faster than any other
method,because they are resolved at complied time.
When a class is declares as final,it cannot be subclassed. Example String,Integer
and other wrapper classes.
Java Interview Tips Cognizant Questions Answers

More Related Content

Similar to Java Interview Tips Cognizant Questions Answers

Java Interview Questions
Java Interview QuestionsJava Interview Questions
Java Interview QuestionsKuntal Bhowmick
 
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 questionsGradeup
 
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 experiencedyearninginjava
 
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 experiencedGaurav Maheshwari
 
Unit No 4 Exception Handling and Multithreading.pptx
Unit No 4 Exception Handling and Multithreading.pptxUnit No 4 Exception Handling and Multithreading.pptx
Unit No 4 Exception Handling and Multithreading.pptxDrYogeshDeshmukh1
 
Java Interview Questions For Freshers
Java Interview Questions For FreshersJava Interview Questions For Freshers
Java Interview Questions For Fresherszynofustechnology
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to javaSujit Majety
 
JAVA VIVA QUESTIONS_CODERS LODGE.pdf
JAVA VIVA QUESTIONS_CODERS LODGE.pdfJAVA VIVA QUESTIONS_CODERS LODGE.pdf
JAVA VIVA QUESTIONS_CODERS LODGE.pdfnofakeNews
 
Java questions for interview
Java questions for interviewJava questions for interview
Java questions for interviewKuntal Bhowmick
 
Java questions and answers jan bask.net
Java questions and answers jan bask.netJava questions and answers jan bask.net
Java questions and answers jan bask.netJanbask ItTraining
 
Java essentials for hadoop
Java essentials for hadoopJava essentials for hadoop
Java essentials for hadoopSeo Gyansha
 
Basic Java Programming
Basic Java ProgrammingBasic Java Programming
Basic Java ProgrammingMath-Circle
 
Internet and Web Technology (CLASS-15) [JAVA Basics] | NIC/NIELIT Web Technol...
Internet and Web Technology (CLASS-15) [JAVA Basics] | NIC/NIELIT Web Technol...Internet and Web Technology (CLASS-15) [JAVA Basics] | NIC/NIELIT Web Technol...
Internet and Web Technology (CLASS-15) [JAVA Basics] | NIC/NIELIT Web Technol...Ayes Chinmay
 

Similar to Java Interview Tips Cognizant Questions Answers (20)

Java Interview Questions
Java Interview QuestionsJava Interview Questions
Java Interview Questions
 
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
 
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
 
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
 
Unit No 4 Exception Handling and Multithreading.pptx
Unit No 4 Exception Handling and Multithreading.pptxUnit No 4 Exception Handling and Multithreading.pptx
Unit No 4 Exception Handling and Multithreading.pptx
 
Java_Interview Qns
Java_Interview QnsJava_Interview Qns
Java_Interview Qns
 
Java Interview Questions For Freshers
Java Interview Questions For FreshersJava Interview Questions For Freshers
Java Interview Questions For Freshers
 
Viva file
Viva fileViva file
Viva file
 
1
11
1
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to java
 
JAVA VIVA QUESTIONS_CODERS LODGE.pdf
JAVA VIVA QUESTIONS_CODERS LODGE.pdfJAVA VIVA QUESTIONS_CODERS LODGE.pdf
JAVA VIVA QUESTIONS_CODERS LODGE.pdf
 
java notes.pdf
java notes.pdfjava notes.pdf
java notes.pdf
 
Core_Java_Interview.pdf
Core_Java_Interview.pdfCore_Java_Interview.pdf
Core_Java_Interview.pdf
 
Java questions for interview
Java questions for interviewJava questions for interview
Java questions for interview
 
Java questions and answers jan bask.net
Java questions and answers jan bask.netJava questions and answers jan bask.net
Java questions and answers jan bask.net
 
Java essentials for hadoop
Java essentials for hadoopJava essentials for hadoop
Java essentials for hadoop
 
Java essentials for hadoop
Java essentials for hadoopJava essentials for hadoop
Java essentials for hadoop
 
Basic Java Programming
Basic Java ProgrammingBasic Java Programming
Basic Java Programming
 
Java basic concept
Java basic conceptJava basic concept
Java basic concept
 
Internet and Web Technology (CLASS-15) [JAVA Basics] | NIC/NIELIT Web Technol...
Internet and Web Technology (CLASS-15) [JAVA Basics] | NIC/NIELIT Web Technol...Internet and Web Technology (CLASS-15) [JAVA Basics] | NIC/NIELIT Web Technol...
Internet and Web Technology (CLASS-15) [JAVA Basics] | NIC/NIELIT Web Technol...
 

Recently uploaded

Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 

Recently uploaded (20)

Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 

Java Interview Tips Cognizant Questions Answers

  • 1. Java Interview Questions and Answers for cognizant: In this Java Interview Questions, I am going to list some of the most important Java Interview Questions and Answers which will help you in the interview process. Java is used by approximately 10 Million developers worldwide to develop applications. It is also used to create applications for trending technologies like Mobiles. And hence today, Java is used everywhere! 1. What do you understand by java?  Java is an object-oriented computer language.  Java is a fast, secure and reliable languageused for many games, devices and applications. 2. What are the major Java features?  Object-Oriented – java is based on object-oriented programming where the class and methods describe about the state and behaviour of object.  Portable – Java program gets converted into Java Byte Codes that can be executed on any platform without any dependency.  Platform independent – java works on “write once and run anywhere” as it supports multiple platforms like Windows, Linux, Mac, Sun Solaris, etc.  Robust – Java has a strong memory management as there is no pointer allocations. It has automatic garbage collection that prohibits memory leaks.  Interpreted – java compiler converts the codes into Java Byte Codes which are then interpreted and executed by Java Interpreter. 2. What doyoumeanby Object?  A Javaobject is a combinationof data andprocedures workingon the available data.  Objects are created from templatesknownas classes. InJava, an object is created usingthe keyword"new". 3. What is class inJava?  A class is a user defined blueprint or prototype from which objects are created. It represents the set of properties or methods that are common to all objects of one type. 4. What is JDK, JREand JVM?  JVM stands for Java Virtual Machine which provides runtime environment for Java Byte Codes to be executed.
  • 2.  JRE stands for Java Runtime Environment that includes sets of files required by JVM during runtime.  JDK stands for Java Development Kit consists of JRE along with the development tools required to write and execute a program. 5. Differentiate between String Buffer and String Builder in Java programming?  String Buffer in java is used to create modifiable String objects. This means that we can use String Buffer to append, reverse, replace, concatenate and manipulate Strings or sequence of characters.  Java String Builder class is designed for use as a drop-in replacement for String Buffer in places where the string buffer was being used by a single thread (as is generally the case). 6. Difference between Array list And Vector?  An array is nothing but a sequential collection same type of elements, accessed by their index values.  Java Array List uses an array as the internal programming construct to store elements.  Vectors in java just another kind of object, of type java.util.Vector. 7. Difference between the Inner Class and Sub Class?  Inner class provides the access rights for the class which is nesting it and that can access all variables and methods defined in the outer class.  Sub-class provides access to all public and protected methods and fields of its super class. 8. Name the methods of Object Class?  clone() – This method helps to create and return a copy of the object.  equals() – This method helps to compare  finalize() – Called by the garbage collector on an object  getClass() – It helps to return the runtime class of an object.  hashCode() – Helps to return a hash code value for the object.  toString() – helps to return a string representation of the object.  notify(), notifyAll(), and wait() – It helps to synchronize the activities of independently running threads in a program. 9. What are Loops in Java? What are three types of loops?  Looping is used in programming to execute a statement or a block of statement repeatedly. There are three types of loops in Java:
  • 3. 1) For Loops For loops are used in java to execute statements repeatedly for a given number of times. For loops are used when number of times to execute the statements is known to programmer. 2) While Loops While loop is used when certain statements need to be executed repeatedly until a condition is fulfilled. In while loops, condition is checked first before execution of statements. 3) Do While Loops Do While Loop is same as while loop with only differencethat condition is checked after execution of block of statements. Hence in case of do while loop, statements are executed at least once. 10. What is Final Keyword in Java? Give an example.  In java, a constant is declared using the keyword Final. Value can be assigned only once and after assignment, value of a constant can't be changed. In below example, a constant with the name const_val is declared and assigned avalue: Private Final int const_val=100 When a method is declared as final,it can NOT be overridden by the subclasses.This method are faster than any other method,because they are resolved at complied time. When a class is declares as final,it cannot be subclassed. Example String,Integer and other wrapper classes.