# Java Interview Questions and Answers
[![Image](https://www.springboottutorial.com/images/Course-Java-Interview-Guide-200-Interview-Questions-and-Answers.png "Java Interview Guide : 200+ Interview Questions and Answers")](https://www.udemy.com/course/java-interview-questions-and-answers/)
## Expectations
- Good Java Knowledge
## Complete Course Link
- https://www.udemy.com/course/java-interview-questions-and-answers/?couponCode=NOVEMBER-2019
## Things You Need to Know
### Github Repository
https://github.com/in28minutes/JavaInterviewQuestionsAndAnswers
### PDF Guide
Available in the resources for the course
### Installing Eclipse, Java and Maven
- PDF : https://github.com/in28minutes/SpringIn28Minutes/blob/master/InstallationGuide-JavaEclipseAndMaven_v2.pdf
- Video : https://www.youtube.com/playlist?list=PLBBog2r6uMCSmMVTW_QmDLyASBvovyAO3
- GIT Repository : https://github.com/in28minutes/getting-started-in-5-steps
## Interview Questions
### Java Platform
- 1 . Why is Java so popular?
- 2 . What is platform independence?
- 3 . What is bytecode?
- 4 . Compare JDK vs JVM vs JRE
- 5 . What are the important differences between C++ and Java?
- 6 . What is the role for a classloader in Java?
### Wrapper Classes
- 7 . What are Wrapper classes?
- 8 . Why do we need Wrapper classes in Java?
- 9 . What are the different ways of creating Wrapper class instances?
- 10 . What are differences in the two ways of creating Wrapper classes?
- 11 . What is auto boxing?
- 12 . What are the advantages of auto boxing?
- 13 . What is casting?
- 14 . What is implicit casting?
- 15 . What is explicit casting?
### Strings
- 16 . Are all String’s immutable?
- 17 . Where are String values stored in memory?
- 18 . Why should you be careful about String concatenation(+) operator in loops?
- 19 . How do you solve above problem?
- 20 . What are differences between String and StringBuffer?
- 21 . What are differences between StringBuilder and StringBuffer?
- 22 . Can you give examples of different utility methods in String class?
### Object oriented programming basics
- 23 . What is a class?
- 24 . What is an object?
- 25 . What is state of an object?
- 26 . What is behavior of an object?
- 27 . What is the super class of every class in Java?
- 28 . Explain about toString method ?
- 29 . What is the use of equals method in Java?
- 30 . What are the important things to consider when implementing equals method?
- 31 . What is the Hashcode method used for in Java?
- 32 . Explain inheritance with examples .
- 33 . What is method overloading?
- 34 . What is method overriding?
- 35 . Can super class reference variable can hold an object of sub class?
- 36 . Is multiple inheritance allowed in Java?
- 37 . What is an interface?
- 38 . How do you define an interface?
- 39 . How do you implement an interface?
- 40 . Can you explain a few tricky things about interfaces?
- 41 . Can you extend an interface?
- 42 . Can a class extend multiple interfaces?
- 43 . What is an abstract class?
- 44 . When do you use an abstract class?
- 45 . How do you define an abstract method?
- 46 . Compare abstract class vs interface?
- 47 . What is a constructor?
- 48 . What is a default constructor?
- 49 . Will this code compile?
- 50 . How do you call a super class constructor from a constructor?
- 51 . Will this code compile?
- 52 . What is the use of this()?
- 53 . Can a constructor be called directly from a method?
- 54 . Is a super class constructor called even when there is no explicit call from a sub class constructor?
### Advanced object oriented concepts
- 55 . What is polymorphism?
- 56 . What is the use of instanceof operator in Java?
- 57 . What is coupling?
- 58 . What is cohesion?
- 59 . What is encapsulation?
- 60 . What is an inner class?
- 61 . What is a static inner class?
- 62 . Can you create an inner class inside a method?
- 63 . What is an anonymous class?
### Modifiers
- 64 . What is default class modifier?
- 65 . What is private access modifier?
- 66 . What is default or package access modifier?
- 67 . What is protected access modifier?
- 68 . What is public access modifier?
- 69 . What access types of variables can be accessed from a class in same package?
- 70 . What access types of variables can be accessed from a class in different package?
- 71 . What access types of variables can be accessed from a sub class in same package?
- 72 . What access types of variables can be accessed from a sub class in different package?
- 73 . What is the use of a final modifier on a class?
- 74 . What is the use of a final modifier on a method?
- 75 . What is a final variable?
- 76 . What is a final argument?
- 77 . What happens when a variable is marked as volatile?
- 78 . What is a static variable?
### conditions & loops
- 79 . Why should you always use blocks around if statement?
- 80 . Guess the output
- 81 . Guess the output
- 82 . Guess the output of this switch block .
- 83 . Guess the output of this switch block?
- 84 . Should default be the last case in a switch statement?
- 85 . Can a switch statement be used around a String
- 86 . Guess the output of this for loop
- 87 . What is an enhanced for loop?
- 88 . What is the output of the for loop below?
- 89 . What is the output of the program below?
- 90 . What is the output of the program below?
### Exception handling
- 91 . Why is exception handling important?
- 92 . What design pattern is used to implement exception handling features in most languages?
- 93 . What is the need for finally block?
- 94 . In what scenarios is code in finally not executed?
- 95 . Will finally be executed in the program below?
- 96 . Is try without a catch is allowed?
- 97 . Is try without catch and finally allowed?
- 98 . Can you explain the hierarchy of exception handling classes?
- 99 . What is the difference between error and exception?
- 100 . What is the difference between checked exceptions and unchecked exceptions?
- 101 . How do you throw an exception from a method?
- 102 . What happens when you throw a checked exception from a method?
- 103 . What are the options you have to eliminate compilation errors when handling checked exceptions?
- 104 . How do you create a custom exception?
- 105 . How do you handle multiple exception types with same exception handling block?
- 106 . Can you explain about try with resources?
- 107 . How does try with resources work?
- 108 . Can you explain a few exception handling best practices?
### Miscellaneous topics
- 109 . What are the default values in an array?
- 110 . How do you loop around an array using enhanced for loop?
- 111 . How do you print the content of an array?
- 112 . How do you compare two arrays?
- 113 . What is an enum?
- 114 . Can you use a switch statement around an enum?
- 115 . What are variable arguments or varargs?
- 116 . What are asserts used for?
- 117 . When should asserts be used?
- 118 . What is garbage collection?
- 119 . Can you explain garbage collection with an example?
- 120 . When is garbage collection run?
- 121 . What are best practices on garbage collection?
- 122 . What are initialization blocks?
- 123 . What is a static initializer?
- 124 . What is an instance initializer block?
- 125 . What is tokenizing?
- 126 . Can you give an example of tokenizing?
- 127 . What is serialization?
- 128 . How do you serialize an object using serializable interface?
- 129 . How do you de-serialize in Java?
- 130 . What do you do if only parts of the object have to be serialized?
- 131 . How do you serialize a hierarchy of objects?
- 132 . Are the constructors in an object invoked when it is de-serialized?
- 133 . Are the values of static variables stored when an object is serialized?
### Collections
- 134 . Why do we need collections in Java?
- 135 . What are the important interfaces in the collection hierarchy?
- 136 . What are the important methods that are declared in the collection interface?
- 137 . Can you explain briefly about the List interface?
- 138 . Explain abo
没有合适的资源?快使用搜索试试~ 我知道了~
免费开源!!Java面试题及答案
![preview](https://csdnimg.cn/release/downloadcmsfe/public/img/white-bg.ca8570fa.png)
共137个文件
java:99个
md:29个
png:2个
![preview-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/scale.ab9e0183.png)
需积分: 5 0 下载量 99 浏览量
2023-10-31
17:56:30
上传
评论
收藏 2.17MB ZIP 举报
温馨提示
面试问题 Java平台 1. 为什么Java如此受欢迎? 2. 什么是平台独立性? 3. 什么是字节码? 4. 比较 JDK、JVM 和 JRE 5. C++ 和 Java 之间的重要区别是什么? 6. Java 中类加载器的作用是什么?
资源推荐
资源详情
资源评论
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![7z](https://img-home.csdnimg.cn/images/20210720083312.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![7z](https://img-home.csdnimg.cn/images/20210720083312.png)
![txt](https://img-home.csdnimg.cn/images/20210720083642.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
收起资源包目录
![package](https://csdnimg.cn/release/downloadcmsfe/public/img/package.f3fc750b.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
共 137 条
- 1
- 2
资源评论
![avatar-default](https://csdnimg.cn/release/downloadcmsfe/public/img/lazyLogo2.1882d7f4.png)
![avatar](https://profile-avatar.csdnimg.cn/e7eb588fad474d5d872f8a50be6d98b6_likestarr.jpg!1)
Web面试那些事儿
- 粉丝: 5597
- 资源: 101
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
最新资源
- 基于jsp+servlet+mysql蛋糕甜品店购物网站源码+数据库(期末大作业).zip
- Java项目:在线蛋糕商城系统(java+jsp+mysql)源码+数据库+期末大作业.zip
- ZapyaClient10_7-1.apk
- 织梦cms站长导航网站源码.zip
- 基于SSM+MySQL的网络投票调查问卷系统源码+数据库(java期末大作业).zip
- 基于jsp+servlet的宠物商城网站系统源码+数据库(java期末大作业).zip
- 基于Python+Tensorflow实现声纹识别+源代码+文档说明.zip
- java-leetcode题解之第112题路径总和.zip
- java-leetcode题解之第111题二叉树的最小深度.zip
- java-leetcode题解之第110题平衡二叉树.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback-tip](https://img-home.csdnimg.cn/images/20220527035111.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)