Java System類exit()方法及示例

系統類exit()方法 (System class exit() method)

  • exit() method is available in java.lang package.

    exit()方法在java.lang包中可用。

  • exit() method is used to exit the currently running JVM (Java Virtual Machine).

    exit()方法用于退出當前正在運行的JVM(Java虛擬機)。

  • exit() method is a static method, it is accessible with the class name too.

    exit()方法是靜態方法,也可以使用類名進行訪問。

  • exit() method may be thrown various type of exception and the description of exception are given below,

    exit()方法可能會引發各種類型的異常,下面給出了異常的描述,

    SecurityException: If a particular method checkExit() does not allow exit with the given exit_status when security manager exists in the method.

    SecurityException :如果特定方法checkExit()不允許在方法中存在安全管理器時使用給定的exit_status退出。

Syntax:

句法:

    public static void exit (int exit_status);

Parameter(s):

參數:

  • exit_status – represents the stages or level of termination of JVM, and here, the non-zero value represents the abnormal termination of JVM.

    exit_status –表示JVM終止的階段或級別,此處,非零值表示JVM的異常終止。

Return value:

返回值:

The return type of this method is void, it does not return any value.

此方法的返回類型為void ,它不返回任何值。

Example:

例:

// Java program to demonstrate the example of 
// exit() method of System Class
public class ExitMethod {
public static void main(String[] args) {
// declaring an array
int array[] = {
10,
20,
30,
40,
50
};
for (int i = 0; i < array.length; ++i) {
if (array[i] < 60) {
System.out.println("Element at index" + " " + i + " is " + array[i]);
} else {
System.out.println("We are exiting JVM normally");
System.exit(0);
}
}
}
}

Output

輸出量

E:\Programs>javac ExitMethod.java
E:\Programs>java ExitMethod
Element at index 0 is 10
Element at index 1 is 20
Element at index 2 is 30
Element at index 3 is 40
Element at index 4 is 50

翻譯自: https://www.includehelp.com/java/system-class-exit-method-with-example.aspx

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/378528.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/378528.shtml
英文地址,請注明出處:http://en.pswp.cn/news/378528.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

基于圖像處理的數碼印花噴墨墨滴形狀規范的研究(Python+OpenCV+Mysql)

大體思路&#xff1a;由于墨滴的不同參數會對墨滴的形態產生一定的影響&#xff0c;故如果通過研究墨滴的形態則通過海量的數據就可以大概確定墨滴的各項參數指標的范圍。通過OpenCV對墨滴的噴出的形狀進行圖像處理&#xff0c;對墨滴圖像進行一系列的分析&#xff0c;通過一系…

ASP.NET 主題(Themes)FAQ

1、主題是什么 主題由一組元素組成&#xff1a;外觀、級聯樣式表 (CSS)、圖像和其他資源。主題將至少包含外觀。主題是在網站或 Web 服務器上的特殊目錄中定義的。主題是一組Web Control的屬性設置的集合&#xff0c;提供一種簡單的方法設置控件的樣式屬性。 主題只在Web Contr…

Head First HTML與CSS、XHTML++筆記(第四章 WEB鎮之旅 第五章 認識媒體)

第四章 鏈接&#xff08;詳解<a>元素&#xff09; 目標錨 在目標位置 <h2><a id"chai">contentTest</a></h2> 在需要鏈接位置 <a href"index.html#chai">See</a> 鏈接到自身的目標錨 <a href"#top"…

Opencv實戰【4】——圖片動漫化處理

博主聯系方式&#xff1a; QQ:1540984562 微信&#xff1a;wxid_nz49532kbh9u22 QQ交流群&#xff1a;750313950 目錄動漫化風格的特點處理手段代碼實現效果總結動漫化風格的特點 &#xff08;1&#xff09;動漫中的細節相對少&#xff1b; &#xff08;2&#xff09;動漫中的邊…

nextshort_Java掃描儀的nextShort()方法與示例

nextshort掃描器類的nextShort()方法 (Scanner Class nextShort() method) Syntax: 句法&#xff1a; public short nextShort();public short nextShort(int rad);nextShort() method is available in java.util package. nextShort()方法在java.util包中可用。 nextShort() …

php 生成css文件怎么打開,php生成html文件的多種步驟介紹

//定義日期函數functiongetdatetime(){$datetimegetdate();$strReturn$datetime["year"]."-";$strReturn$strReturn.$datetime["mon"]."-";$strReturn$strReturn.$datetime["mday"];return$strReturn;}//定義時間函數(文件名…

08-KNN手寫數字識別

標簽下載地址 文件內容備注train-images-idx3-ubyte.gz訓練集圖片&#xff1a;55000張訓練圖片&#xff0c;5000張驗證圖片train-labels-idx1-ubyte.gz訓練集圖片對應的數字標簽t10k-images-idx3-ubyte.gz測試集圖片&#xff1a;10000張圖片t表示test&#xff0c;測試圖片&…

MFC odbc訪問遠程數據庫

首先&#xff0c;MFC通過ODBC訪問數據庫&#xff0c;主要使用兩個類&#xff0c;一個是CDataBase&#xff0c;一個是CRecordset。第一個是用于建立數據庫連接的&#xff0c;第二個是數據集&#xff0c;用來查詢的。步驟如下&#xff1a;1.實例化一個CDataBase對象&#xff0c;并…

微機原理——擴展存儲器設計

目錄【1】存儲器的層次結構【2】存儲器的分類【3】SRAM1、基本原理&#xff1a;2、結構&#xff1a;3、芯片參數與引腳解讀&#xff1a;4、CPU與SRAM的連接方式【4】DRAM1、基本原理&#xff1a;2、結構3、芯片引腳解讀&#xff1a;【5】存儲器系統設計【6】存儲器擴展設計&…

floatvalue 重寫_Java Number floatValue()方法與示例

floatvalue 重寫Number類floatValue()方法 (Number Class floatValue() method) floatValue() method is available in java.lang package. floatValue()方法在java.lang包中可用。 floatValue() method is used to return the value denoted by this Number object converted …

array_column php什么版本可以用,array_column兼容php5.5以下版本

gistfile1.txt// ----------------------------------------------------------------------// |獲取二維數組中指定的一列&#xff0c;PHP5.5以后有專用函數array_column()// ----------------------------------------------------------------------// |param array $arr// …

。net學習之控件的使用注意點

jQuery使用 1、自定義屬性的使用<script>$(#xwjj_i_main br[brinfoPd_KangQiao_Subject_Xwjj_br_1]).hide();</script> 2、ready代碼塊$(document).ready(function(){ //你的代碼}); 3、簡單的特效hide&#xff08;&#xff09;$("a").click(function()…

09-CNN手寫數字識別

CNN卷積神經網絡的本質就是卷積運算 維度的調整&#xff1a; tf.reshape(imageInput,[-1,28,28,1]) imageInput為[None,784]&#xff0c;N行* 784維 調整為 M28行28列*1通道 即&#xff1a;二維轉化為四維數據 參數一&#xff1a;等價于運算結果M 參數二&#xff1a;28 28 表示…

【轉】左值與右值

出處&#xff1a;http://www.embedded.com/electronics-blogs/programming-pointers/4023341/Lvalues-and-Rvalues C and C enforce subtle differences on the expressions to the left and right of the assignment operator If youve been programming in either C or C for…

Opencv將處理后的視頻保存出現的問題

問題描述&#xff1a; 代碼運行過程中&#xff0c;imshow出來的每幀的效果圖是正確的&#xff0c;但是按照網上的方法保存下來卻是0kb&#xff0c;打開不了。 參考的網上的一些方法&#xff0c;均是失敗的&#xff0c;具體原因我也不清楚&#xff1a; 1、例如我這樣設置&#x…

Java Number shortValue()方法與示例

Number類shortValue()方法 (Number Class shortValue() method) shortValue() method is available in java.lang package. shortValue()方法在java.lang包中可用。 shortValue() method is used to return the value denoted by this Number object converted to type short (…

MATLAB可以打開gms文件嗎,gms文件擴展名,gms文件怎么打開?

.gms文件類型&#xff1a;Gesture and Motion Signal File擴展名為.gms的文件是一個數據文件。文件說明&#xff1a;Low-level, binary, minimal but generic format used to organize and store Gesture and Motion Signals in a flexible and optimized way; gesture-related…

黑白圖片顏色反轉并保存

將圖像的黑白顏色反轉并保存 import cv2 # opencv讀取圖像 img cv2.imread(rE:\Python-workspace\OpenCV\OpenCV/YY.png, 1) cv2.imshow(img, img) img_shape img.shape # 圖像大小(565, 650, 3) print(img_shape) h img_shape[0] w img_shape[1] # 彩色圖像轉換為灰度圖…

家貓WEB系統

現在只放源碼在些.為它寫應用很簡單有空整理文檔演示地址:jiamaocode.com/os/ 源碼&#xff1a;http://jiamaocode.com/ProCts/2011/04/14/1918/1918.html轉載于:https://www.cnblogs.com/jiamao/archive/2011/04/16/2018339.html

C# DataRow數組轉換為DataTable

public DataTable ToDataTable(DataRow[] rows) { if (rows null || rows.Length 0) return null; DataTable tmp rows[0].Table.Clone(); // 復制DataRow的表結構 foreach (DataRow row in rows) tmp.Rows.Add(row); // 將DataRow添加…