tag:blogger.com,1999:blog-8712770457197348465.post9013956258141636925..comments2025-01-07T04:58:30.529-08:00Comments on Javarevisited: Top 15 Java Multithreading, Concurrency Interview Questions Answers asked in Investment banksjavin paulhttp://www.blogger.com/profile/15028902221295732276[email protected]Blogger35125tag:blogger.com,1999:blog-8712770457197348465.post-76054413837811198642022-10-09T02:00:03.845-07:002022-10-09T02:00:03.845-07:00One of the benefits is when your class is already ...One of the benefits is when your class is already extending another class. You must implements the Runnable interface since in Java you can extends only ONE classAnonymous[email protected]tag:blogger.com,1999:blog-8712770457197348465.post-45790830068591519962021-03-20T05:34:20.737-07:002021-03-20T05:34:20.737-07:00Hello Rakib, I recommend Core Java by Cay S. Hors...Hello Rakib,<br /><br />I recommend Core Java by Cay S. Horstmann and Effective Java by Joshua Block, if you need a complete list you can check my list of <a href="https://javarevisited.blogspot.com/2017/02/top-5-core-java-books-for-beginners.html#axzz5bPNuWoFU" rel="nofollow">best core java books for beginner</a>javin paulhttps://www.blogger.com/profile/15028902221295732276[email protected]tag:blogger.com,1999:blog-8712770457197348465.post-44749621802458023672021-03-10T22:52:48.511-08:002021-03-10T22:52:48.511-08:00Javin, really good questions. Just another query w...Javin, really good questions. Just another query which core java book you recommned to understand concepts.<br /><br /><br /><br />Read more: https://javarevisited.blogspot.com/2018/07/java-multi-threading-interview-questions-answers-from-investment-banks.html#ixzz6omfHG82PRakibhttps://www.blogger.com/profile/00048049195628320161[email protected]tag:blogger.com,1999:blog-8712770457197348465.post-28833997158922986512019-03-25T04:52:50.647-07:002019-03-25T04:52:50.647-07:00I tried answering the above questions, for few i a...I tried answering the above questions, for few i attached the source link, please feel free to go through and let me know if anything wrong.<br /><br />1) Difference between green thread and native thread in Java?<br />A) <br />• Green threads are scheduled by a virtual machine. <br />• Native threads are scheduled by a operational system.<br /><br />2) Difference between thread and process? (januhttps://www.blogger.com/profile/12047194362611643445[email protected]tag:blogger.com,1999:blog-8712770457197348465.post-11151872705054193882019-03-02T07:27:02.761-08:002019-03-02T07:27:02.761-08:00good questions. But your answers are not to the po...good questions. But your answers are not to the point. You are saying &quot;this topic is also important. This.. That.. etc&quot;. But you are not explaining the actual answer properly. It will be better if you can focus on the answer.<br /><br />For the 1st question, your answer was this...<br />&quot;This thread interview question is mostly asked in the first round or phone screening round of Anonymous[email protected]tag:blogger.com,1999:blog-8712770457197348465.post-9511095709506979492015-07-20T04:56:37.022-07:002015-07-20T04:56:37.022-07:00While execution , a thread in ExecutorFramework ...While execution , a thread in ExecutorFramework throws some exception.How can we notify this exception to the calling application.Anonymous[email protected]tag:blogger.com,1999:blog-8712770457197348465.post-18897795774431645362015-07-11T22:23:41.247-07:002015-07-11T22:23:41.247-07:00answer of question 1: MyRunnable.java public clas...answer of question 1:<br /><br />MyRunnable.java<br />public class MyRunnable implements Runnable {<br /> private String name;<br /> public MyRunnable(){<br /> <br /> }<br /> public MyRunnable(String name){<br /> this.name=name;<br /> }<br /> @Override<br /> public void run() {<br /> // TODO Auto-generated method stub<br /> for(int i=0;i&lt;5;i++){<br /> System.out.println(&quot;Thread nameAnonymous[email protected]tag:blogger.com,1999:blog-8712770457197348465.post-12445179706487318552014-08-09T04:53:24.553-07:002014-08-09T04:53:24.553-07:00This was asked in my recent interview . Object ob1...This was asked in my recent interview .<br />Object ob1 has two methods A and B.<br />You have two Threads (Thread 1 and Thread 2)<br /><br />Question is I should be access Method A of Ob1 from Thread 1 and at the same time Thread 2 should be able to access Method B of Ob1.<br /><br />However if Thread 1 is using Method A , then Thread 2 should not be able to use Method A of Ob1.<br />How is Anonymous[email protected]tag:blogger.com,1999:blog-8712770457197348465.post-35144131600307698242014-07-15T23:42:55.530-07:002014-07-15T23:42:55.530-07:00Hi Guys, This is Nihar.I have one question from t...Hi Guys,<br /> This is Nihar.I have one question from threading concept i.e in an application 0-10 thread is good or 10-100 thread..which one &amp; why????Anonymoushttps://www.blogger.com/profile/09837140114798926492[email protected]tag:blogger.com,1999:blog-8712770457197348465.post-62652205445675219992014-03-27T05:44:59.008-07:002014-03-27T05:44:59.008-07:00Thanks for the list of questions and all the great...Thanks for the list of questions and all the great comments. I wanted to point out an error in #11 though. <br /><br />When you call the start() method in the Thread class, it does not directly call the run() method. It calls a native code method start0(). This native code will only schedule the thread to be executed with the ThreadScheduler. The JVM will then grab the item from the cbphttps://www.blogger.com/profile/09250070918595174519[email protected]tag:blogger.com,1999:blog-8712770457197348465.post-41302913548602656242013-12-25T19:46:41.427-08:002013-12-25T19:46:41.427-08:00I think you could do better by adding few more mul...I think you could do better by adding few more multithreading and concurrency questions from java.util.concurrent package e.g. <br /><br />1) Difference between Callable and Runnable interface in Java?<br />2) What is FutureTask in Java? What is benefit of using it?<br />3) Difference between Thread.isInterrupted() and Thread.interrupt() method?<br />4) How ConcurrentHashMap achieves scalability?Gopal[email protected]tag:blogger.com,1999:blog-8712770457197348465.post-58306323977141029112013-11-12T10:27:36.587-08:002013-11-12T10:27:36.587-08:00package com.learning.material; public class MyThr...package com.learning.material;<br /><br />public class MyThread {<br /><br /> /**<br /> * @param args<br /> */<br /> public static void main(String[] args) throws InterruptedException {<br /> <br /> System.out.println(&quot;i am the Main thread...starting......&quot;);<br /> <br /> final Thread t1 = new Thread(){<br /> public void run(){<br /> System.out.println(&quot;i am thread 1 Sekhar babu Karrihttps://www.blogger.com/profile/01622784461597168363[email protected]tag:blogger.com,1999:blog-8712770457197348465.post-57314868517045215312013-09-28T10:28:25.607-07:002013-09-28T10:28:25.607-07:00Javin, I am a Java developer with 10+ years of exp...Javin, I am a Java developer with 10+ years of experience and accidentally bumped into your blog around 15 days ago. Since then, I am stuck with it :-). I tried to read thru so many articles that you wrote and they are extremely useful and extremely well written with a lot of clarity on the fundamental concepts! Its a great job! Keep it up!<br /><br />I have a couple of questions on threads: <br Anonymoushttps://www.blogger.com/profile/17505490511935196950[email protected]tag:blogger.com,1999:blog-8712770457197348465.post-8814299834550341562013-08-12T21:04:56.386-07:002013-08-12T21:04:56.386-07:00Why knowledge of multithreading in Java is so impo...Why knowledge of multithreading in Java is so important to get a Job? What makes it so desirable and same time tough to get master?Andrew[email protected]tag:blogger.com,1999:blog-8712770457197348465.post-16045693189545190532013-04-26T22:01:55.342-07:002013-04-26T22:01:55.342-07:00I was asked to implement thread pool in java as we...I was asked to implement thread pool in java as well and they were interested in knowing key things you would consider to design pool Anonymous[email protected]tag:blogger.com,1999:blog-8712770457197348465.post-12084674691422215932013-04-16T20:52:42.246-07:002013-04-16T20:52:42.246-07:00Hi Guys, I would like to share one of the Intervie...Hi Guys, I would like to share one of the Interview Question related to ThreadPool implementation. I was asked in JP Morgan and Chase that , What should you take care, if you have to make your own Thread Pool? I thought about Executors framework of Java 5 but couldn&#39;t answer much. I am interested in points, what are the important points one should take care while creating there own thread Rashi[email protected]tag:blogger.com,1999:blog-8712770457197348465.post-41193381001040426472013-02-11T16:09:23.687-08:002013-02-11T16:09:23.687-08:00@Javin : The main advantage of new Locks over Sync...@Javin : The main advantage of new Locks over Synchronized block is to handle Deadlock better way. In blocks once deadlock happens you have no way to fix it unless restart the jvm but Lock gives you tools to handle deadlock situations. Other benefits are bonus :)Skye Nighthttps://www.blogger.com/profile/15520833613915085187[email protected]tag:blogger.com,1999:blog-8712770457197348465.post-38132050727670753582012-12-04T23:53:21.038-08:002012-12-04T23:53:21.038-08:00Javin, really good questions. Just another query w...Javin, really good questions. Just another query which core java book you recommned to understand concepts.Anonymous[email protected]tag:blogger.com,1999:blog-8712770457197348465.post-43941852319966737722012-08-28T00:10:01.660-07:002012-08-28T00:10:01.660-07:00Please try to answer question dont leave reader in...Please try to answer question dont leave reader in dark room<br /> Anonymous[email protected]tag:blogger.com,1999:blog-8712770457197348465.post-50426408296384579672012-07-21T05:21:44.262-07:002012-07-21T05:21:44.262-07:00@Jon, You bring the very interesting point about J...@Jon, You bring the very interesting point about Java interviews,Many do and which I guess is not bad because if some one can solve the problem you are facing than it&#39;s good signal that guy can be useful.Javin @ transient vs volatilehttp://javarevisited.blogspot.sg/2012/03/difference-between-transient-and.html[email protected]tag:blogger.com,1999:blog-8712770457197348465.post-3679567923182268832012-07-21T05:15:50.610-07:002012-07-21T05:15:50.610-07:00Is it possible that interviewers do not always kno...Is it possible that interviewers do not always know the answers, and are taking advantage of job interviews to get free software consultancy?johnny1980https://www.blogger.com/profile/09815317614582934897[email protected]tag:blogger.com,1999:blog-8712770457197348465.post-41957078060506382142012-04-10T20:02:19.340-07:002012-04-10T20:02:19.340-07:00Can you please share some multi-threading question...Can you please share some multi-threading questions asked in Google Interviews. I am very interested on what these top companies like Google, Amazon, Facebook or Investment banks like Nomura or Goldman asked in Java, JVM and Threading. ThanksAnonymous[email protected]tag:blogger.com,1999:blog-8712770457197348465.post-8317123635955540072012-04-09T06:10:52.807-07:002012-04-09T06:10:52.807-07:00Hi Peter, Good to see you back here :) difference ...Hi Peter, Good to see you back here :) difference between volatile in Java and C++ is a good question if you mention C++ in your resume and also taking a thread dump programmatically and with command prompt in case of deadlock is a good skill to have. What is current trend, have you spotted any new trend related to concurrency in Java interviews ?Javin @ thread safe class in javahttp://javarevisited.blogspot.com/2012/01/how-to-write-thread-safe-code-in-java.html[email protected]tag:blogger.com,1999:blog-8712770457197348465.post-43676663334087132742012-04-08T00:50:15.474-07:002012-04-08T00:50:15.474-07:001. I would call run() instead of start() ;) 2. I ...1. I would call run() instead of start() ;)<br /><br />2. I would make it clear there is a difference between ReentrantLock and ReentrantReadWriteLock.<br /><br />4. While I started programming Java before version 5.0, many people started programming after 2004, so I wouldn&#39;t consider the concurrency library that new as there when many people started. BTW It was available as a separate Peter Lawreyhttps://www.blogger.com/profile/17982030676088168612[email protected]tag:blogger.com,1999:blog-8712770457197348465.post-60343741323491899782012-03-23T07:10:58.810-07:002012-03-23T07:10:58.810-07:00Thanks Kamal. I have shared many of those in my bl...Thanks Kamal. I have shared many of those in my blog, just use search box on top left. by the way here are few :<br /><a href="http://javarevisited.blogspot.com/2011/03/10-interview-questions-on-singleton.html" rel="nofollow"> 10 questions on Singleton Pattern in Java </a><br /><a href="http://javarevisited.blogspot.com/2010/10/why-string-is-immutable-in-java.html" rel="nofollow">Why String is Javin @ Servelt Interview Questionshttp://javarevisited.blogspot.com/2011/09/servlet-interview-questions-answers.html[email protected]