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

java define_Java Long类的define()方法与示例相关推荐

  1. Java黑皮书课后题第5章:**5.38(十进制转八进制)编写程序,提示用户输入一个十进制整数,然后显示对应的八进制值。(不要是使用Java的Integer类的任何方法)

    **5.38(十进制转八进制)编写程序,提示用户输入一个十进制整数,然后显示对应的八进制值.(不要是使用Java的Integer类的任何方法) 题目 题目概述 破题 代码 运行示例 题目 题目概述 * ...

  2. java的ThreadLocal类的使用方法

    java的ThreadLocal类的使用方法,ThreadLocal是一个支持泛型的类,用在多线程中用于防止并发冲突问题. 比如以下的一个样例,就是用于线程添加1,可是相互不冲突 package co ...

  3. Java中String类的concat方法___java的String字符串的concat()方法连接字符串和“+“连接字符串解释

    Java中String类的concat方法 在了解concat()之前,首先需要明确的是String的两点特殊性. 长度不可变 值不可变 这两点从源码中对String的声明可以体现: private ...

  4. java.util.zip 用法,Java压缩文件工具类ZipUtil使用方法代码示例

    本文实例通过Java的Zip输入输出流实现压缩和解压文件,前一部分代码实现获取文件路径,压缩文件名的更改等,具体如下: package com.utility.zip; import java.io. ...

  5. JAVA中console方法怎么用,java的Console类的使用方法及实例

    java的Console类的使用方法及实例 JDK 6中提供了java.io.Console类专用来访问基于字符的控制台设备.如果你的Java程序要与Windows下的cmd或者Linux下的Term ...

  6. Java 中Date类getTime()的方法

    Java 中Date类getTime()的方法 1.getTime() /**Returns the number of milliseconds since January 1, 1970, 00: ...

  7. java enummap_Java EnumMap size()方法与示例

    java enummap EnumMap类的size()方法 (EnumMap Class size() method) size() method is available in java.util ...

  8. java treemap_Java TreeMap size()方法与示例

    java treemap TreeMap类的size()方法 (TreeMap Class size() method) size() method is available in java.util ...

  9. java scanner_Java Scanner nextLong()方法与示例

    java scanner 扫描器类的nextLong()方法 (Scanner Class nextLong() method) Syntax: 句法: public long nextLong(); ...

最新文章

  1. 物联网网关市场预计到2026年将增长21.5亿美元
  2. java 检查输入_在java中检查输入的问题
  3. Leetcode 191. 位1的个数 解题思路及C++实现
  4. 青年歌手大奖赛_评委会打分
  5. Tapable.plugin is deprecated. Use new API on `.hooks` instead
  6. spring aop不执行_使用Spring AOP重试方法执行
  7. Mac不再丝滑?这些有用的方法了解一下
  8. 孪生再世代表数字几_能科股份:智能制造需求旺盛,中标多领域数字孪生项目
  9. c# MessageBox 用法大全
  10. 大厂面试八股文——数据库mysql
  11. 内外兼修的移动办公伴侣:联想YOGA S730评测体验
  12. 从巨噬细胞macrophage_clean先去 除线粒体再提取AM1 AM2 AM3
  13. 【C++】队列优先队列详解——deque.queue.priority_queue
  14. linux下几款可用网盘对比
  15. html5设置全屏背景图,HTML5 body设置全屏背景图片 如何让body的背景图片自适应整个屏----实战经验...
  16. 第10章 集成MyBatis
  17. 借助云开发,利用订阅消息,云函数路由实现小程序好友一对一聊天,添加好友等仿微信功能
  18. 前端高频面试题-场景题
  19. 接口性能测试方案 白皮书 V1.0
  20. jquery.SuperSlide

热门文章

  1. 导入ansys的实体怎么进行parameter_ANSYS在线缆线束设计中的仿真应用
  2. mysql怎样dao出数据库_mysql怎么导出数据库?
  3. html中两个图片叠放,CSS实现图片叠放(勾选图标)
  4. java w3c xml_org.w3c.dom(java dom)解析XML文档
  5. 手机耗电统计app_华为手机有哪些功能关掉比较好?
  6. 哪款笔记本电脑好_扫地机器人哪个牌子好?口碑最好的扫地机器人
  7. ModuleNotFoundError: No module named ‘torch.utils.serialization‘
  8. Spark Mlib TFIDF源码详读 笔记
  9. MFC中的几种播放声音的方法
  10. sql 存储过程返回值 变量名