threads in java interview questions and answers

Learn about threads in java interview questions and answers, we have the largest and most updated threads in java interview questions and answers information on alibabacloud.com

About Java Set frame face questions (including answers) under _java

we don't want to repeat, we should use set. (2) Some collection classes allow the initial capacity to be specified, so if we can estimate the number of storage elements, we could use it to avoid a hash or resize. (3) Based on interface programming, rather than on implementation programming, it allows us to easily change implementations later. (4) Always use type-safe generics to avoid classcastexception at run time. (5) using the immutable class provided by JDK as the key of the map, you ca

Some questions about Java threads, processes

1. On multicore hardware, can multiple threads of the same process in Java run on different CPUs?It should be possible to run a simulation program on Eclipse, a dead loop thread can occupy the system (4 cores, Win7) andthe cpu,4 of such a thread just occupies 100%. This can be explained from the side that threads can be assigned to different cores. Of course, a s

5 questions per day seven (Java threads)

Java.lang.Runnable interface to execute, since the thread class itself is the runnable interface of the call so you can inherit the Java.lang.Thread classor call the Runnable interface directly to override the run () method to implement the thread.With runnable or thread?The question is the follow-up, and we all know that we can implement threads by inheriting the thread class or calling the Runnable interface, and the question is, what better way? U

Java Learning Lesson 28th (Multithreading (vii))-stopping threads and multithreaded faces questions

()//Line Cheng Zi class {public void Run () {for (int i = 0;iMulti-threaded interview questions:1.Class Text implements Runnable{public void Run (Thread t) {}}//failed to compile? What if the failure error?failed with overwrite of Run method not implementedChange Law One:Abstract class Text implements Runnable{public void Run (Thread t) {}}Change method Two: overload, coverClass Text implements Runnable{public void Run () {System.out.println ("Text.r

Java threading common face questions include adding minus 1 to multiple threads without using an inner class

Class ManyThreads2 {private int j = 0;Public synchronized Void Inc () {j + +;System.out.println (Thread.CurrentThread (). GetName () + "Inc" + j); }public synchronized void Dec () {j--;System.out.println (Thread.CurrentThread (). GetName () + "Dec" + j);}}public class MyTest extends Thread {Private MANYTHREADS2 many = new ManyThreads2 ();public void Run (){many.inc ();Many.dec ();Many.inc ();Many.dec ();}public static void Main (string[] args) {TODO auto-generated Method StubMyTest MyTest = new

Total Pages: 5 1 2 3 4 5 Go to: Go

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.