java define_Java Long類的define()方法與示例

java define

長類解碼()方法 (Long class decode() method)

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

    在java.lang包中提供了define ()方法

  • decode() method is used to decode the given String value into a Long value.

    encode()方法用于將給定的String值解碼為Long值。

  • decode() method is a static method, it is accessible with the class name too and if we try to access the method with the class object then also we will not get an error.

    encode()方法是一個靜態方法,也可以使用類名進行訪問,如果我們嘗試使用類對象訪問該方法,那么也不會收到錯誤。

  • decode() method may throw a NumberFormatException at the time of decoding a String to a Long.

    在將String解碼為Long時, decode()方法可能會引發NumberFormatException。

    NumberFormatException: In this exception, if the given string parameter does not have a parsable integer.

    NumberFormatException:在此異常中,如果給定的字符串參數沒有可解析的整數。

Syntax:

句法:

    public static Long decode(String str);

Parameter(s):

參數:

  • String str – represents the String to decode.

    字符串str –表示要解碼的字符串。

Return value:

返回值:

The return type of this method is long, it returns the Long holding a long value represented by the argument of String type.

該方法的返回類型為long ,它返回Long,其中Long持有一個用String類型的參數表示的long值。

Example:

例:

// Java program to demonstrate the example 
// of decode(String str) method of Long class
public class DecodeOfLongClass {
public static void main(String[] args) {
// Variables initialization
long l = 100;
String str = "20";
// Long object initialized with "long" value
Long ob1 = new Long(l);
// Display ob1 result
System.out.println("ob1: " + ob1);
// It returns an Long object holding the long value 
// denoted by the given String argument by calling 
// ob1.decode(str)
Long result = ob1.decode(str);
// Display result
System.out.println("ob1.decode(str) :" + result);
}
}

Output

輸出量

ob1: 100
ob1.decode(str) :20

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

java define

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

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

相關文章

linux修改文件用戶組,linux命令 修改文件、文件夾所屬用戶、用戶組

最近學習hadoop,在替換配置文件的時候,發現老是報錯,沒有權限替換。我們知道如何改變文件的用戶組與擁有者了,那么,什么時候要使用chown或chgrp呢?或許你會覺得奇怪吧?是的,確實有時…

Kotlin 開篇

Kotlin 是一個基于 JVM 的新的編程語言,由 JetBrains 開發官網地址:http://kotlinlang.org。JetBrains,作為目前廣受歡迎的 Java IDE IntelliJ 的提供商,在 Apache 許可下已經開源其Kotlin 編程語言。開源地址:https:/…

inputstream示例_Java InputStream close()方法與示例

inputstream示例InputStream類close()方法 (InputStream Class close() method) close() method is available in java.io package. close()方法在java.io包中可用。 close() method is used to close this InputStream and free all system resources linked with this stream…

linux下的文件系統,Linux根文件系統(“/”文件系統)下的目錄介紹

Linux下的文件存儲與Windows完全不同,Windows將系統文件存儲在系統盤(比如說C:\下)Linux根本沒有盤符到概念只有一個根文件系/,各個磁盤分區掛載在/media/下(或者/mnt/下)/下到如/etc,/proc,/bin,/dev,lib等很是讓用慣了Windows的用戶不解,下…

greenlet 詳解

greenlet初體驗回到頂部Greenlet是python的一個C擴展,來源于Stackless python,旨在提供可自行調度的‘微線程’, 即協程。generator實現的協程在yield value時只能將value返回給調用者(caller)。 而在greenlet中,target.switch&am…

Java Calendar toString()方法與示例

日歷類toString()方法 (Calendar Class toString() method) toString() method is available in java.util package. toString()方法在java.util包中可用。 toString() method is used to string denotations of the calendar object. toString()方法用于對日歷對象的符號進行字…

linux虛擬機怎么看var文件,一種獲取Linux虛擬機內部日志的方法

一種獲取Linux虛擬機內部日志的方法【技術領域】[0001]本發明涉及云計算管理技術領域,特別是指一種獲取Linux虛擬機內部日志的方法。【背景技術】[0002]在云計算環境下,虛擬機被廣泛使用,對于虛擬機的維護要求越來越高,當虛擬機出…

詳細圖解mongodb 3.4.1 win7x64安裝

原文:http://www.cnblogs.com/yucongblog/p/6895983.html 詳細圖解,記錄 win7 64 安裝mongo數據庫的過程。安裝的版本是 MongoDB-win32-x86_64-2008plus-ssl-3.4.1-signed。 我下載的源文件:mongodb-win32-x86_64-2008plus-ssl-3.4.1-signed我…

java calendar_Java Calendar complete()方法與示例

java calendarCalendar類的complete()方法 (Calendar Class complete() method) complete() method is available in java.util package. complete()方法在java.util包中可用。 complete() method is used to fills in any non-set fields in the calendar fields. complete()方…

LXD 2.0 系列(十二):調試,及給 LXD 做貢獻

介紹 終于要結束了!這個大約一年前開始的這系列文章的最后一篇博文。 LXD 入門安裝與配置你的第一個 LXD 容器資源控制鏡像管理遠程主機及容器遷移LXD 中的 DockerLXD 中的 LXD實時遷移LXD 和 JujuLXD 和 OpenStack調試,及給 LXD 做貢獻如果你從一開始就…

linux用ping命令測試網速,linux下面使用命令測試網速

大家都知道在speedtest是市面上最準確最全面的測速工具,但在linux命令行不能直接使用,所以我們就借助腳本調用speedtest的接口來利用他測試網速。1.下載speedtest-cli腳本:下載地址:https://raw.githubusercontent.com/sivel/spee…

Java ArrayList isEmpty()方法與示例

ArrayList類isEmpty()方法 (ArrayList Class isEmpty() method) isEmpty() method is available in java.util package. isEmpty()方法在java.util包中可用。 isEmpty() method is used to check whether this Arraylist is "empty" or "not empty". isEmp…

linux家用系統版本,查看linux系統版本

篇一:linux下如何查看系統和內核版本linux下如何查看系統和內核版本 1. 查看內核版本命令:1) [rootq1test01 ~]# cat /proc/versionLinux version 2.6.9-22.ELsmp (bhcompilecrowe.devel.redhat.com) (gcc version 3.4.4 20050721 (Red Hat 3.4.4-2)) #1…

python中locked_Python鎖類| 帶示例的locked()方法

python中lockedPython Lock.locked()方法 (Python Lock.locked() Method) locked() is an inbuilt method of the Lock class of the threading module in Python. Locked()是Python中線程模塊的Lock類的內置方法。 This method returns True if the lock is acquired by a th…

rocksdb ubuntu c++源碼編譯測試

2019獨角獸企業重金招聘Python工程師標準>>> 環境: ubuntu16.4 需要安裝 snappy gflage bz2 zstd 以及g 其中zstd是facebook開放源代碼里的壓縮的庫 git clone https://github.com/facebook/rocksdb.git cd rocksdb make static_lib 成功生成 librocksd…

vs生成linux服務器程序,從Visual Studio到Linux上調試C++代碼

從Visual Studio到Linux上調試C代碼04/30/20155 分鐘可看完本文內容[原文發表時間] 2015/4/29 10:00 PM正如您可能已經聽說的那樣,Visual Studio 2015新推出了對Android開發的GDB支持。有趣的是,因為這項功能依賴GDB調試,我們完全可能稍加改動…

java clock計時_Java Clock類| 實例的Instant()方法

java clock計時Clock Class Instant()方法 (Clock Class instant() method) instant() method is available in java.time package. Instant()方法在java.time包中可用。 instant() method is used to get the current instant that is used with this Clock. Instant()方法用于…

使用國內DOCKER鏡像源

在國內,通過Docker的pull和push命令訪問hub.docker時,網絡十分慢,而且會出現各種各樣的網絡連接問題。因此這里介紹下如何使用國內的鏡像源,這里以DaoCloud為例。注冊DaoCloud用戶;注冊完成后,會進入dashboard頁面&…

linux命令top查看進程,linux 查看進程的命令(top)

標簽:top操作系統支持多任務并不是計算機同時做很多事情,而是快速的輪換著執行這些任務。linux安排不同的程序等待使用CPU。進程的工作方式:當系統啟動的時候,內核先把自己的程序初始化為進程,然后運行一個init的程序&…

stl vector 函數_vector :: back()函數以及C ++ STL中的示例

stl vector 函數C vector :: back()函數 (C vector::back() function) vector::back() is a library function of "vector" header, it is used to access the last element from the vector, it returns a reference to the last element of the vector. vector ::…