Tough core Java interview questions and answers
What is tough core java interview question ? Why do people look for tough Java questions before going for interview? well I don't thing I need to answer these tough questions because its pretty natural to prepare for tough questions even if you are not expecting tough questions from core Java. If you are prepare for tough and tricky Java interview question than you feel more confident and answer other Java interview question with confidence. On the other hand if you are not prepare for tough and tricky core Java questions than seeing them on Java interview or written test may surprise you. But definition of tough core Java questions is not universal, same Java question which is easy for one programmer might be tough for other Java programmer. That's why it's best to prepare your own list of tough interview questions before appearing on any Java job interview. In this article I am going to share you with my Top 10 tough core Java interview questions and answers, which may help you in Java interview.

10 tough Java interview question and answer

Here is my list of 10 tough or tricky Java interview questions. These questions are mostly from Core Java and I have not included J2EE questions. As I said you may know answers of these tough Java question or you may not even find it tough enough to challenge your Java knowledge but once upon a time these were asked in various Java interview and many programmer including my friends and colleagues finds them tough to answer.

Why wait and notify is declared in Object class instead of Thread ?
Another tough java question, how can you answer this question if you are not designed Java programming language. anyway some common sense and deep knowledge of Java programming helps to answer such tough core java interview question. See this blog post to learn  Why wait and notify is declared in Object class and not in Thread.

Why multiple inheritance is not supported in Java ?
I found this core Java question really tough to answer because your answer may not satisfy Interviewer, in most cases Interviewer is looking for specific points and if you can bring them, they would be happy. Key to answer this kind of tough question in Java is to prepare topic well to accommodate any follow-ups. See Why multiple inheritance is not supported in Java for answer of this tough Java question.

Why Java does not support operator overloading ?
One more similar category of  tough Java question. C++ supports operator overloading than why not Java? this is the argument Interviewer will give to you and some time even say that + operator is overloaded in Java for String concatenation, Don't be fooled with such arguments. See  Why support operator overloading is not supported in Java for detailed answer of this tricky Java question.

Why String is immutable in Java?
My favorite Java interview question, this is tough, tricky but same time very useful as well. Some interviewer also ask this question as Why String is final in Java. look at this post for some points which make sense on Why String is final or immutable in Java

Why char array is preferred to store password than String in Java?
Another tricky Java question which is based on String and believe me there are only few Java programmer which can answer this question correctly. This is a real tough core Java interview question and again solid knowledge of String is required to answer this. see Why char array is better than String for storing password in Java to find out answer of this tough Java question.

How to create thread-safe singleton in Java using double checked locking?
This Java question is also asked as What is thread-safe singleton  and how to do you write it. Well Singleton created with double checked locking before Java 5 was broker and its possible to have multiple instance of Singleton if multiple thread try to create instance of Singleton at same time. from Java 5 its easy to create thread safe Singleton using Enum. but if interviewer persist with double checked locking then you have to write that code for them. remember to use volatile variable.  See 10 Java singleton interview question for more details on this topic.

Write Java program to create deadlock in Java and fix it ?
One of the classical but tough core Java interview question and you are likely to fail if you have not involved in coding of multi-threaded concurrent Java application. See  how to create and prevent deadlock in Java for complete answer of  this tough core Java interview question

What happens if your Serializable class contains a member which is not  serializable? How do you fix it?
Any attempt to Serialize that class will fail with NotSerializableException, but this can be easily solved by making that variable transient for static in Java. See Top 10 Serialization interview question answers in Java for more details.

Why wait and notify  called from synchronized method in Java?
Another tough core Java question for wait and notify. They are called from synchronized method or synchronized block because wait and modify need monitor on Object on which wait or notify get called. See  Why wait and notify require synchronized context for complete answer of this tough and tricky Java multi-threading question.

Can you override static method in Java? if I create same method in subclass is it compile time error?
No you can not override static method in Java but its not a compile time error to declare exactly same method in sub class, That is called method hiding in Java. See  Can you override static method in Java for complete answer of this tough Java interview question.

These were my list of tough core Java interview question and answers. Some of the Java question doesn't look that tough for experience programmer but they are really tricky to answer for intermediate and beginners in Java. by the way if you have faced any tough Java question in interview then please share with us.

source: http://java67.blogspot.sg/2012/09/top-10-tough-core-java-interview-questions-answers.html

转载于:https://www.cnblogs.com/glenblogs/p/3746687.html

Top 10 tough core Java interview questions answers programming相关推荐

  1. Java Interview Questions

    Question: What is the difference between an Interface and an Abstract class?   Question: What is the ...

  2. APACHE TOMCAT INTERVIEW QUESTIONS ANSWERS【转】

    原文地址:https://www.wisdomjobs.com/e-university/apache-tomcat-interview-questions.html Question 1. What ...

  3. [转]Design Pattern Interview Questions - Part 2

    Interpeter , Iterator , Mediator , Memento and Observer design patterns. (I) what is Interpreter pat ...

  4. 35+ Top Apache Tomcat Interview Questions And Answers【转】

    原文地址:https://www.softwaretestinghelp.com/apache-tomcat-interview-questions/ Most frequently asked Ap ...

  5. C# Interview Questions and Answers

    What's C# ?C# (pronounced C-sharp) is a new object oriented language from Microsoft and is derived f ...

  6. English job interview Questions and Answers

    "What are your goals for the future?" or "Where do you see yourself in five years?&qu ...

  7. Top 10 Mistakes Java Developers Make(转)

    文章列出了Java开发者最常犯的是个错误. 1.将数组转换为ArrayList 为了将数组转换为ArrayList,开发者经常会这样做: ? 1 List<String> list = A ...

  8. Java developer interview questions: The hard part

    Since I've attended several job interviews recently, I've decided toshare some experience with you. ...

  9. Java书籍Top 10

    下面是Java Inside上推荐的十本不错的Java书籍.(文章来源) 1)Java Language Specification, Third Edition (by James Gosling) ...

  10. ASP.NET Core中的OWASP Top 10 十大风险-跨站点脚本攻击 (XSS)

    本博文翻译自: https://dotnetcoretutorials.com/2017/10/25/owasp-top-10-asp-net-core-cross-site-scripting-xs ...

最新文章

  1. 用计算机画曲线教案,小学信息技术曲线工具教案
  2. Martini源码剖析
  3. 动态路由协议(RIP)
  4. 三网融合试点,是一个商机还是烫山芋?
  5. Android开发,使用背景图(xml drawable)为view 设置边框
  6. 为何你仍是一名社畜码农?
  7. 官方版sublime Text3汉化和激活注册码
  8. Android自动测试之Monkey工具2
  9. 作为字节跳动的研发面试官,有些话我不得不说!
  10. 请假系统特例规则详细设计
  11. linux灯控软件下载,舞台灯光控制软件(MaizeDMX)
  12. led同步回显到计算机屏幕,手把手教您如何将笔记本电脑的画面投屏到LED大屏幕上显示,音视频同步传输...
  13. 使用am instrument验证CTS问题
  14. ThinkPHP带表情无限级评论回复
  15. 什么是PSD(功率谱密度)
  16. minisforum HX90G/HX99G miniPC-Hackintosh-Opencore 黑苹果efi引导文件
  17. 2014年互联网IT公司产品、技术类人员工资待遇汇总 2015部分补充
  18. Visual C++游戏编程基础之多背景循环动画
  19. Java调用excel宏
  20. Arcmap做地图要领总结

热门文章

  1. 文件加密系统,随时保护终端数据安全
  2. 几种建模工具简介(SPSS,SAS,Stata,R,Matlab,Amos,Lisrel)
  3. 【正点原子STM32连载】第二章 STM32简介 摘自【正点原子】MiniPro STM32H750 开发指南_V1.1
  4. 淘宝分类大全及其分组 (MySql, xls)文件,上下关系,拼写,层级,层级树,提示,2022年2月28日数据
  5. 图解设计模式-Flyweight模式
  6. ESIX群晖NAS安装教程
  7. RedHat7可视化图形界面安装
  8. redhat7 安装telnet服务
  9. ccccccccccccccccccccc
  10. 软件工程经济学知识点总结