下載本文檔
版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、Java關(guān)于線程的面試題(英文)問(wèn)題:Java關(guān)于線程的面試題(英文)回答: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. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2024高考地理一輪復(fù)習(xí)第九章第2講工業(yè)地域的形成與工業(yè)區(qū)教案含解析新人教版
- 2024高考化學(xué)二輪復(fù)習(xí)專題突破練4B元素及其化合物含解析
- 二零二五年度股東分紅紅利分配與投資計(jì)劃合同3篇
- 第二章復(fù)合材料增強(qiáng)體2017上課講義
- 小學(xué)食品安全管理制度
- 分階段分層次全過(guò)程質(zhì)量管控機(jī)制
- 單病種填報(bào)要求(更新至20240911)
- 2024年河北軟件職業(yè)技術(shù)學(xué)院高職單招語(yǔ)文歷年參考題庫(kù)含答案解析
- 2024年閘北區(qū)市北醫(yī)院高層次衛(wèi)技人才招聘筆試歷年參考題庫(kù)頻考點(diǎn)附帶答案
- 二零二五年度離婚協(xié)議中個(gè)人隱私保護(hù)協(xié)議
- 專題6.8 一次函數(shù)章末測(cè)試卷(拔尖卷)(學(xué)生版)八年級(jí)數(shù)學(xué)上冊(cè)舉一反三系列(蘇科版)
- GB/T 4167-2024砝碼
- 老年人視覺障礙護(hù)理
- 《腦梗塞的健康教育》課件
- 《請(qǐng)柬及邀請(qǐng)函》課件
- 遼寧省普通高中2024-2025學(xué)年高一上學(xué)期12月聯(lián)合考試語(yǔ)文試題(含答案)
- 《個(gè)體防護(hù)裝備安全管理規(guī)范AQ 6111-2023》知識(shí)培訓(xùn)
- 青海原子城的課程設(shè)計(jì)
- 2023年年北京市各區(qū)初三語(yǔ)文一模分類試題匯編 - 作文
- 第二講VSP地震勘探
- 干砌石護(hù)坡工程施工組織設(shè)計(jì)方案
評(píng)論
0/150
提交評(píng)論