![Java关于线程的面试题(英文)_第1页](http://file4.renrendoc.com/view/57da03e2c05770ecb39e4addd76fd972/57da03e2c05770ecb39e4addd76fd9721.gif)
![Java关于线程的面试题(英文)_第2页](http://file4.renrendoc.com/view/57da03e2c05770ecb39e4addd76fd972/57da03e2c05770ecb39e4addd76fd9722.gif)
![Java关于线程的面试题(英文)_第3页](http://file4.renrendoc.com/view/57da03e2c05770ecb39e4addd76fd972/57da03e2c05770ecb39e4addd76fd9723.gif)
![Java关于线程的面试题(英文)_第4页](http://file4.renrendoc.com/view/57da03e2c05770ecb39e4addd76fd972/57da03e2c05770ecb39e4addd76fd9724.gif)
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、Java关于线程的面试题(英文)问题:Java关于线程的面试题(英文)回答:Do I need to use synchronized on setValue(int) It depends whether the method affects method local variables, class static or instance variables. If only method local variables are changed, the value is said to be confined by the method and is not prone to thread
2、ing issues.Do I need to use synchronized on setValue(int) It depends whether the method affects method local variables, class static or instance variables. If only method local variables are changed, the value is said to be confined by the method and is not prone to threading issues.What is the Swin
3、gUtilities.invokeLater(Runnable) method for The static utility method invokeLater(Runnable) is intended to execute a new runnable thread from a Swing application without disturbing the normal sequence of event dispatching from the Graphical User Interface (GUI). The method places the runnable object
4、 in the queue of Abstract Windowing Toolkit (AWT) events that are due to be processed and returns immediately. The runnable object s run() methodis only called when it reaches the front of the queue. The deferred effect of the invokeLater(Runnable) method ensures that any necessary updates to the us
5、er interface can occur immediately, and the runnable work will begin as soon as those high priorityevents are dealt with. The invoke latermethod might be used to start work in response to a button click that also requires a significantchange to the userinterface,perhaps to restrict other activities,
6、 while therunnable thread executes.What is the volatile modifier for The volatile modifier is used to identify variables whose values should not be optimized by the Java Virtual Machine, by caching the value for example. The volatile modifier is typically used for variables that may be accessed or m
7、odified by numerous independent threads and signifies that the value may change without synchronization.Which class is the wait() method defined in The wait() method is defined in the Object class, which is the ultimate superclass of all others. So the Thread class and any Runnable implementation in
8、herit this method from Object. The wait() method is normally called on an object in a multi-threaded program to allow other threads to run. The method should should only be called by a thread that has ownership of the object s monitor, which usually means it is in a synchronized method or statement
9、block.Which class is the wait() method defined in I get incompatible return type for my thread s getState( ) method! It sounds like your application was built for a Java software development kit before Java 1.5. The Java API Thread class method getState() was introduced in version 1.5. Your thread m
10、ethod has the same name but different return type. The compiler assumes your application code is attempting to override the API method with a different return type, which is not allowed, hence the compilation error.What is a working thread A working thread, more commonly known as a worker thread is
11、the key part of a design pattern that allocates one thread to execute one task. When the task is complete, the thread may return to a thread pool for later use. In this scheme a thread may execute arbitrary tasks, which are passed in the form of a Runnable method argument, typically execute(Runnable
12、). The runnable tasks are usually stored in a queue until a thread host is available to run them. The worker thread design pattern is usually used to handle many concurrent tasks where it is notimportant which finishes first and no single task needs to be coordinated with another. The task queue con
13、trols how many threads run concurrently to improve the overall performance of the system. However, a worker thread framework requires relatively complex programming to set up, so should not be used where simpler threading techniques can achieve similar results.What is a green thread A green thread r
14、efers to a mode of operation for the Java Virtual Machine (JVM) in which all code is executed in a single operating system thread. If the Java program has any concurrent threads, the JVM manages multi-threading internally rather than using other operating system threads. There is a significant proce
15、ssing overhead for the JVM to keep track of thread states and swap between them, so green thread mode has been deprecated and removed from more recent Java implementations. Current JVM implementations make more efficient use of native operating system threads.What are native operating system threads
16、 Native operating system threads are those provided by the computer operating system that plays host to a Java application, be it Windows, Mac or GNU/Linux. Operating system threads enable computers to run many programs simultaneously on the same central processing unit (CPU) without clashing over the use of system res
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 一年级上册数学听评课记录《7.3 有几瓶牛奶(4)》北师大版
- 苏教版小学数学二年级上乘法口算试题
- 公司厨师聘用合同范本
- 任务二贸易合同范本
- 2022年新课标八年级上册历史第一单元中国开始沦为半殖民地半封建社会1-3课共3课时听课评课记录
- 2025年度股权增资扩股协议-创新科技研发合作
- 2025年度返点合作协议版:人力资源服务销售返利合作方案
- 2025年度污水管安装工程进度与结算合同
- 2025年度股东对公司无息借款及财务支持合同
- 2025年度老式摩托车俱乐部会员权益续费合同
- 2025公司借款合同范本借款合同
- 闽教版(2020)小学信息技术三年级上册第2课《人工智能在身边》说课稿及反思
- 语文-百师联盟2025届高三一轮复习联考(五)试题和答案
- 地理-山东省潍坊市、临沂市2024-2025学年度2025届高三上学期期末质量检测试题和答案
- 正面上手发球技术 说课稿-2023-2024学年高一上学期体育与健康人教版必修第一册
- 佛山市普通高中2025届高三下学期一模考试数学试题含解析
- 人教 一年级 数学 下册 第6单元 100以内的加法和减法(一)《两位数加一位数(不进位)、整十数》课件
- 事故隐患排查治理情况月统计分析表
- 永磁直流(汽车)电机计算程序
- 小班期末家长会-双向奔赴 共育花开【课件】
- 国家电网招聘2025-企业文化复习试题含答案
评论
0/150
提交评论