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

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
 
Java programming basics
Java programming basicsJava programming basics
Java programming basicsHamid Ghorbani
 
Nitish Chaulagai Java1.pptx
Nitish Chaulagai Java1.pptxNitish Chaulagai Java1.pptx
Nitish Chaulagai Java1.pptxNitishChaulagai
 
Java programming material for beginners by Nithin, VVCE, Mysuru
Java programming material for beginners by Nithin, VVCE, MysuruJava programming material for beginners by Nithin, VVCE, Mysuru
Java programming material for beginners by Nithin, VVCE, MysuruNithin Kumar,VVCE, Mysuru
 
Object-Oriented Programming with Java UNIT 1
Object-Oriented Programming with Java UNIT 1Object-Oriented Programming with Java UNIT 1
Object-Oriented Programming with Java UNIT 1SURBHI SAROHA
 

Similar to Java Interview Tips Cognizant Questions Answers (20)

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...
 
java basic .pdf
java basic .pdfjava basic .pdf
java basic .pdf
 
Java programming basics
Java programming basicsJava programming basics
Java programming basics
 
Nitish Chaulagai Java1.pptx
Nitish Chaulagai Java1.pptxNitish Chaulagai Java1.pptx
Nitish Chaulagai Java1.pptx
 
Java programming material for beginners by Nithin, VVCE, Mysuru
Java programming material for beginners by Nithin, VVCE, MysuruJava programming material for beginners by Nithin, VVCE, Mysuru
Java programming material for beginners by Nithin, VVCE, Mysuru
 
Java1
Java1Java1
Java1
 
Java
Java Java
Java
 
Object-Oriented Programming with Java UNIT 1
Object-Oriented Programming with Java UNIT 1Object-Oriented Programming with Java UNIT 1
Object-Oriented Programming with Java UNIT 1
 

Recently uploaded

Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptxmary850239
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Seán Kennedy
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptxMusic 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptxleah joy valeriano
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptxiammrhaywood
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4JOYLYNSAMANIEGO
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 

Recently uploaded (20)

Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptxMusic 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 

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.