SlideShare a Scribd company logo
1 of 15
Java
Java Interview Questions
What are the Main features of Java?
 Object Oriented: Java is an object Oriented language where everything is
done keeping objects (data) in mind.
 Simple: Java is very easy to learn and follow. It’s syntax are very easy . Any
programmer who has some basic knowledge about any object oriented
language like c++ can easily follow Java.
 Platform Independent: Java is a write once, run everywhere language. That
means java program written on one platform can be run on any other
platforms without much difficulties.
 Secured: Java is a highly secured language through which you can develop
virus-free and highly secured applications
 Robust: Java is a robust because of automatic garbage collection, better
exception and error handling mechanism, no explicit use of pointers and
better memory management system.
What are the Main features of Java?
 Portable: Java is portable because you can run java byte code on any
hardware which has compliant JVM which converts byte-code according to
that particular hardware.
 Multithreaded: Java supports multithreaded programming where multiple
threads execute their task simultaneously.
 Distributed: Java is distributed because you can develop distributed large
applications using Java concepts like RMI and EJB.
 Dynamic: Java is a dynamic language because it supports loading of classes on
demand.
 Extensible: You can develop new classes using existing interfaces, you can
declare new methods
What are the Main features of Java?
 Functional Style Programming: With the introduction of lambda expressions,
functional interfaces and Stream API in Java 8 you can also write
Functional style of programming in Java
What is the latest version of Java?
 Java 17 or JDK 17 is the latest version of Java which is released on September
14, 2021. (Keep checking Oracle website for latest Java releases).
What are the fundamental principles
of object oriented programming?
 Inheritance
 Abstraction
 Polymorphism
 Encapsulation
What do you mean by inheritance in
Java?
 Inheritance is one of the key principle of object oriented programming.
Through inheritance, one class can inherit the properties of another class.
The class from which properties are inherited is called super class and the
class to which properties are inherited is called sub class.
What are the different types of
inheritance?
 a) Single Inheritance : One class is extended by only one class.
 b) Multilevel Inheritance : One class is extended by a class and that class in turn is extended
by another class thus forming a chain of inheritance.
 c) Hierarchical Inheritance : One class is extended by many classes. Her class thus forming a
chain of inheritance.
 d) Hybrid Inheritance : It is a combination of above types of inheritance.
 e) Multiple Inheritance : One class extends more than one classes. (Java does not support
multiple inheritance)
 6) does Java supports multiple inheritance? If not, why?
 To avoid ambiguity, complexity and confusion, Java does not supports multiple inheritance.
i.e. a class in Java can not extend more than one classes. For example, if Class C extends
Class A and Class B which have a method with same name, then Class C will have two
methods with same name. This causes ambiguity and confusion for which method to use. To
avoid this, Java does not supports multiple inheritance.
What are the different types of
inheritance?
 a) Single Inheritance : One class is extended by only one class.
 b) Multilevel Inheritance : One class is extended by a class and that class in
turn is extended by another class thus forming a chain of inheritance.
 c) Hierarchical Inheritance : One class is extended by many classes. Her class
thus forming a chain of inheritance.
 d) Hybrid Inheritance : It is a combination of above types of inheritance.
 e) Multiple Inheritance : One class extends more than one classes. (Java does
not support multiple inheritance)
does Java supports multiple
inheritance? If not, why?
 To avoid ambiguity, complexity and confusion, Java does not supports
multiple inheritance. i.e. a class in Java can not extend more than one
classes. For example, if Class C extends Class A and Class B which have a
method with same name, then Class C will have two methods with same
name. This causes ambiguity and confusion for which method to use. To avoid
this, Java does not supports multiple inheritance.
If Java doesn’t supports multiple
inheritance, then how do you implement
multiple inheritance in Java?
 Through interfaces, we can implement multiple inheritance in Java. A class in
Java can not extend more than one classes, but a class can implement more
than one interfaces.
What is the parent class of all classes
in Java?
 Java.lang.Object class
You know that all classes in Java are
inherited from java.lang.Object class. Do
interfaces also inherited from
java.lang.Object class?
 No only classes in Java are inherited from java.lang.object class. Interfaces in
 Java are not inherited from java.lang.object class. But, classes which
implement interfaces are inherited from java.lang.Object Class
How do you restrict a member of a class
from inheriting to it’s sub classes?
 By declaring that member as a private. Because, private members are not
inherited to sub classes.
Can a class extend itself?
 No, a class can not extend itself.

More Related Content

What's hot

Object Oriented Programming with Java
Object Oriented Programming with JavaObject Oriented Programming with Java
Object Oriented Programming with Java
backdoor
 
Java classes and objects interview questions
Java classes and objects interview questionsJava classes and objects interview questions
Java classes and objects interview questions
Dhivyashree Selvarajtnkpm
 
11 advance inheritance_concepts
11 advance inheritance_concepts11 advance inheritance_concepts
11 advance inheritance_concepts
Arriz San Juan
 

What's hot (20)

The smartpath information systems java
The smartpath information systems javaThe smartpath information systems java
The smartpath information systems java
 
Suga java training_with_footer
Suga java training_with_footerSuga java training_with_footer
Suga java training_with_footer
 
JAVA PROGRAMMING – Packages - Stream based I/O
JAVA PROGRAMMING – Packages - Stream based I/O JAVA PROGRAMMING – Packages - Stream based I/O
JAVA PROGRAMMING – Packages - Stream based I/O
 
37 Java Interview Questions
37 Java Interview Questions37 Java Interview Questions
37 Java Interview Questions
 
Object Oriented Programming with Java
Object Oriented Programming with JavaObject Oriented Programming with Java
Object Oriented Programming with Java
 
Java interview questions 1
Java interview questions 1Java interview questions 1
Java interview questions 1
 
Oops in Java
Oops in JavaOops in Java
Oops in Java
 
Java/J2EE interview Qestions
Java/J2EE interview QestionsJava/J2EE interview Qestions
Java/J2EE interview Qestions
 
Unit 4 Java
Unit 4 JavaUnit 4 Java
Unit 4 Java
 
Core java notes with examples
Core java notes with examplesCore java notes with examples
Core java notes with examples
 
OCA Java SE 8 Exam Chapter 5 Class Design
OCA Java SE 8 Exam Chapter 5 Class DesignOCA Java SE 8 Exam Chapter 5 Class Design
OCA Java SE 8 Exam Chapter 5 Class Design
 
Java interview
Java interviewJava interview
Java interview
 
Questions of java
Questions of javaQuestions of java
Questions of java
 
Java classes and objects interview questions
Java classes and objects interview questionsJava classes and objects interview questions
Java classes and objects interview questions
 
Core java by amit
Core java by amitCore java by amit
Core java by amit
 
11 advance inheritance_concepts
11 advance inheritance_concepts11 advance inheritance_concepts
11 advance inheritance_concepts
 
Java interface
Java interface Java interface
Java interface
 
Java
JavaJava
Java
 
Reflection in Java
Reflection in JavaReflection in Java
Reflection in Java
 
Chapter 9 java
Chapter 9 javaChapter 9 java
Chapter 9 java
 

Similar to Java interview-quetions

JAVA ITCS 1213 Self-check Quiz Interfaces 1) What is an interface comp.docx
JAVA ITCS 1213 Self-check Quiz Interfaces 1) What is an interface comp.docxJAVA ITCS 1213 Self-check Quiz Interfaces 1) What is an interface comp.docx
JAVA ITCS 1213 Self-check Quiz Interfaces 1) What is an interface comp.docx
olsenlinnea427
 

Similar to Java interview-quetions (20)

Object Oriented Programming - 7.1. Inheritance
Object Oriented Programming - 7.1. InheritanceObject Oriented Programming - 7.1. Inheritance
Object Oriented Programming - 7.1. Inheritance
 
Automation Testing - Part 2 (Things to know in JAVA) - SLT
Automation Testing - Part 2 (Things to know in JAVA) - SLTAutomation Testing - Part 2 (Things to know in JAVA) - SLT
Automation Testing - Part 2 (Things to know in JAVA) - SLT
 
Automation Testing - Part 2 (Things to know in JAVA) - SLT
Automation Testing - Part 2 (Things to know in JAVA) - SLTAutomation Testing - Part 2 (Things to know in JAVA) - SLT
Automation Testing - Part 2 (Things to know in JAVA) - SLT
 
java_vyshali.pdf
java_vyshali.pdfjava_vyshali.pdf
java_vyshali.pdf
 
Java_notes.ppt
Java_notes.pptJava_notes.ppt
Java_notes.ppt
 
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...
 
1
11
1
 
Unit 4
Unit 4Unit 4
Unit 4
 
Java OOPS Concept
Java OOPS ConceptJava OOPS Concept
Java OOPS Concept
 
Java Interview Questions For Freshers
Java Interview Questions For FreshersJava Interview Questions For Freshers
Java Interview Questions For Freshers
 
Core java questions
Core java questionsCore java questions
Core java questions
 
Java Interview Questions
Java Interview QuestionsJava Interview Questions
Java Interview Questions
 
Introduction to Inheritance in Java for presentation
Introduction to Inheritance in Java for presentationIntroduction to Inheritance in Java for presentation
Introduction to Inheritance in Java for presentation
 
JAVA ITCS 1213 Self-check Quiz Interfaces 1) What is an interface comp.docx
JAVA ITCS 1213 Self-check Quiz Interfaces 1) What is an interface comp.docxJAVA ITCS 1213 Self-check Quiz Interfaces 1) What is an interface comp.docx
JAVA ITCS 1213 Self-check Quiz Interfaces 1) What is an interface comp.docx
 
Inheritance ppt
Inheritance pptInheritance ppt
Inheritance ppt
 
Java ppt
Java pptJava ppt
Java ppt
 
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
 
C# question answers
C# question answersC# question answers
C# question answers
 
Basic java important interview questions and answers to secure a job
Basic java important interview questions and answers to secure a jobBasic java important interview questions and answers to secure a job
Basic java important interview questions and answers to secure a job
 
Classes and Objects
Classes and ObjectsClasses and Objects
Classes and Objects
 

Recently uploaded

Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Krashi Coaching
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 
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
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
SoniaTolstoy
 

Recently uploaded (20)

IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
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
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
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...
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 

Java interview-quetions

  • 2. What are the Main features of Java?  Object Oriented: Java is an object Oriented language where everything is done keeping objects (data) in mind.  Simple: Java is very easy to learn and follow. It’s syntax are very easy . Any programmer who has some basic knowledge about any object oriented language like c++ can easily follow Java.  Platform Independent: Java is a write once, run everywhere language. That means java program written on one platform can be run on any other platforms without much difficulties.  Secured: Java is a highly secured language through which you can develop virus-free and highly secured applications  Robust: Java is a robust because of automatic garbage collection, better exception and error handling mechanism, no explicit use of pointers and better memory management system.
  • 3. What are the Main features of Java?  Portable: Java is portable because you can run java byte code on any hardware which has compliant JVM which converts byte-code according to that particular hardware.  Multithreaded: Java supports multithreaded programming where multiple threads execute their task simultaneously.  Distributed: Java is distributed because you can develop distributed large applications using Java concepts like RMI and EJB.  Dynamic: Java is a dynamic language because it supports loading of classes on demand.  Extensible: You can develop new classes using existing interfaces, you can declare new methods
  • 4. What are the Main features of Java?  Functional Style Programming: With the introduction of lambda expressions, functional interfaces and Stream API in Java 8 you can also write Functional style of programming in Java
  • 5. What is the latest version of Java?  Java 17 or JDK 17 is the latest version of Java which is released on September 14, 2021. (Keep checking Oracle website for latest Java releases).
  • 6. What are the fundamental principles of object oriented programming?  Inheritance  Abstraction  Polymorphism  Encapsulation
  • 7. What do you mean by inheritance in Java?  Inheritance is one of the key principle of object oriented programming. Through inheritance, one class can inherit the properties of another class. The class from which properties are inherited is called super class and the class to which properties are inherited is called sub class.
  • 8. What are the different types of inheritance?  a) Single Inheritance : One class is extended by only one class.  b) Multilevel Inheritance : One class is extended by a class and that class in turn is extended by another class thus forming a chain of inheritance.  c) Hierarchical Inheritance : One class is extended by many classes. Her class thus forming a chain of inheritance.  d) Hybrid Inheritance : It is a combination of above types of inheritance.  e) Multiple Inheritance : One class extends more than one classes. (Java does not support multiple inheritance)  6) does Java supports multiple inheritance? If not, why?  To avoid ambiguity, complexity and confusion, Java does not supports multiple inheritance. i.e. a class in Java can not extend more than one classes. For example, if Class C extends Class A and Class B which have a method with same name, then Class C will have two methods with same name. This causes ambiguity and confusion for which method to use. To avoid this, Java does not supports multiple inheritance.
  • 9. What are the different types of inheritance?  a) Single Inheritance : One class is extended by only one class.  b) Multilevel Inheritance : One class is extended by a class and that class in turn is extended by another class thus forming a chain of inheritance.  c) Hierarchical Inheritance : One class is extended by many classes. Her class thus forming a chain of inheritance.  d) Hybrid Inheritance : It is a combination of above types of inheritance.  e) Multiple Inheritance : One class extends more than one classes. (Java does not support multiple inheritance)
  • 10. does Java supports multiple inheritance? If not, why?  To avoid ambiguity, complexity and confusion, Java does not supports multiple inheritance. i.e. a class in Java can not extend more than one classes. For example, if Class C extends Class A and Class B which have a method with same name, then Class C will have two methods with same name. This causes ambiguity and confusion for which method to use. To avoid this, Java does not supports multiple inheritance.
  • 11. If Java doesn’t supports multiple inheritance, then how do you implement multiple inheritance in Java?  Through interfaces, we can implement multiple inheritance in Java. A class in Java can not extend more than one classes, but a class can implement more than one interfaces.
  • 12. What is the parent class of all classes in Java?  Java.lang.Object class
  • 13. You know that all classes in Java are inherited from java.lang.Object class. Do interfaces also inherited from java.lang.Object class?  No only classes in Java are inherited from java.lang.object class. Interfaces in  Java are not inherited from java.lang.object class. But, classes which implement interfaces are inherited from java.lang.Object Class
  • 14. How do you restrict a member of a class from inheriting to it’s sub classes?  By declaring that member as a private. Because, private members are not inherited to sub classes.
  • 15. Can a class extend itself?  No, a class can not extend itself.