Java Double类parseDouble()方法的示例

Double类parseDouble()方法 (Double class parseDouble() method)

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

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

  • parseDouble() method is used to return the double value corresponding to the given String or in other words we can say this method is used to convert a string value to double value.

    parseDouble()方法用于返回对应于给定String的double值,换句话说,我们可以说此方法用于将字符串值转换为double值。

  • parseDouble() 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.

    parseDouble()方法是一个静态方法,也可以使用类名进行访问,如果我们尝试使用类对象访问该方法,那么我们也不会收到错误。

  • parseDouble() method may throw a NumberFormatException at the time of conversion from string double,

    从字符串double转换时, parseDouble()方法可能会引发NumberFormatException,

    NumberFormatException: In this exception, when the string argument does not have parsable double.

    NumberFormatException:在此异常中,当string参数没有可分析的double时。

Syntax:

句法:

    public static double parseDouble(String str);

Parameter(s):

参数:

  • String str – represents the string value to be parsed.

    字符串str –表示要解析的字符串值。

Return value:

返回值:

The return type of this method is double, it returns the corresponding double value.

此方法的返回类型为double ,它返回相应的double值。

Example:

例:

// Java program to demonstrate the example 
// of parseDouble(String str) method of Double class
public class ParseDoubleOfDoubleClass {
public static void main(String[] args) {
// Variables initialization
String str1 = "100";
String str2 = "6.7";
// Object initialization
Double d1 = new Double(str2);
// It convert string into double by calling parseDouble() method
// and store the result in another variable of double type
double result = d1.parseDouble(str1);
// Display result
System.out.println("d1.parseDouble(str1): " + result);
}
}

Output

输出量

d1.parseDouble(str1): 100.0

翻译自: https://www.includehelp.com/java/double-class-parsedouble-method-with-example.aspx

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.pswp.cn/news/379366.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

ffmpeg命令 拉流

1: 拉流播放:rtmp (ffplay rtmp://server/live/streamName) ffplay -x 480 -y 320 rtmp://58.200.131.2:1935/livetv/cctv1 2: 拉流存储到文件:rtmp ffmpeg -i rtmp://58.200.131.2:1935/livetv/cctv1 -codec copy cctvrtmp.f…

小心pthread_cond_signal和SetEvent之间的差异

ZZ FROM: http://blog.csdn.net/absurd/article/details/1402433 转载时请注明出处和作者联系方式&#xff1a;http://blog.csdn.net/absurd 作者联系方式&#xff1a;Li XianJing <xianjimli at hotmail dot com> 更新时间&#xff1a;2006-12-19 今天帮同事查一个多线…

eshop.sql(复制的时候注意路径!!!)

USE [master] GO /****** Object: Database [eshop] Script Date: 2019/11/25 星期一 上午 08:54:14 / CREATE DATABASE [eshop] ON PRIMARY ( NAME N’eshop_dat’, FILENAME N’D:\eshop\eshop_dat.mdf’ , SIZE 10240KB , MAXSIZE 51200KB , FILEGROWTH 5120KB ) LOG O…

doublevalue_Java Double类doubleValue()方法与示例

doublevalueDouble类doubleValue()方法 (Double class doubleValue() method) doubleValue() method is available in java.lang package. doubleValue()方法在java.lang包中可用。 doubleValue() method is used to return the value denoted by this Double object converted…

ffmpeg 命令过滤器裁剪

1 图片操作&#xff1a; 原图&#xff1a; 使用ffplay 显示左半边 ffplay -i input.png -vf cropiw/2:ih:0:0 可以通过ffmpeg 保存 ffmpeg -i input.png -vf cropiw/2:ih:0:0 out.png 2 视频操作&#xff1a; 原视频&#xff1a; 显示左半边 ffplay -i cctvhttp.flv -vf …

去除aspx生成的页面最开始的空行

使用.aspx生成的页面一般都会有一个或多个空行&#xff0c;当然这些空行不会影响页面在浏览器中的渲染结果&#xff0c;不过在查看源代码的时候感觉有些别扭&#xff0c;我曾试着去删除这些空行&#xff0c;但没有成功&#xff0c;你知道你们有没有去尝试。 1 <% Page Langu…

PUBLISH.sql(复制的时候注意路径!!!)

USE [master] – GO – /****** Object: Database [PUBLISH] Script Date: 2019/11/25 星期一 上午 09:00:04 / – CREATE DATABASE [PUBLISH] ON PRIMARY – ( NAME N’PUBLISH’, FILENAME N’F:\PUBLISH\PUBLISH.mdf’ , SIZE 51200KB , MAXSIZE UNLIMITED, FILEGROWTH …

c ++ 函数的esp指针_在C ++中通过指针访问成员函数

c 函数的esp指针Create a class along with data member and member functions and then access the member functions by using a pointer in C. 创建一个类以及数据成员和成员函数&#xff0c;然后使用C 中的指针访问成员函数。 如何通过指针访问成员函数&#xff1f; (How…

[iphone-cocos2d]分享一段Objective-C可调用的游戏中播放音乐(1)

首先需要引入AudioTool 这个framework 代码 -(id)initWithPath:(NSString *)path{ UInt32 size, maxPacketSize; char*cookie; inti; if(gThereIsAnActiveTrack) { NSLog("*** WARNING *** GBMusicTrack only plays one track at a time…

汇编语言-010(循环移位ROL,ROR 、进位循环进位RCL,RCR 、有符号数溢出 、双精度移位SHLD,SHRD、SHL和ADD计算 、位运算应用)

1 &#xff1a;循环移位ROL,ROR,带进位循环进位RCL,RCR .386 .model flat,stdcall.stack 4096 ExitProcess PROTO,dwExitCode:DWORD.code main PROC;循环左移mov al,40h ;AL 010000000brol al,1 ;AL 100000000b ,CF 0rol al,1 ;AL 000000001b ,CF 1rol al,1 ;A…

[Z]POJ 计算几何入门题目推荐[转PKKJ]

http://www.cnblogs.com/eric-blog/archive/2011/05/31/2064785.html http://hi.baidu.com/novosbirsk/blog/item/723a9727a9ab8804918f9dca.html其实也谈不上推荐&#xff0c;只是自己做过的题目而已&#xff0c;甚至有的题目尚未AC&#xff0c;让在挣扎中。之所以推荐计算几何…

2013年 833c语言程序 江南大学 (A卷)

1.编写程序实现求两个整数最大公约数和最小公倍数. 方法一&#xff1a;辗转相除法 算法思路&#xff1a;两个整数a,b,其中a>b&#xff0c;求其最大公约数和最小公倍数 步骤① a%bc,其中c为余数 步骤② 若余数c为0&#xff0c;即a可以把b给整除,也就是说这里的b就是其最大公…

二十几岁失败的原因

1.缺乏人生目标。在研究过的人们中&#xff0c;9.98%的人没有"人生目标"&#xff0c;这恐怕是人们失败的最大原因。  2.自学能力不足。历史上所谓掌握最高教育的人&#xff0c;几乎都是"自学型"的。所谓"有教育"的人&#xff0c;不能只看成是有…

C程序生成一定范围内的随机数

Random numbers just numbers that lie within a range and any of the numbers can occur. 随机数只是在一个范围内的数字&#xff0c;任何数字都可能出现。 In programming, we come through a lot of scenarios where we need to generate random numbers. Like for dice g…

提示丢失libgcc_s_dw2-1.dll问题

QT使用MinGW编译器编译中的的执行文件&#xff0c;执行问题 将qt中安装的mingw编码器的路径添加到环境变量path (D:\Qt\Qt5.10.1\5.10.1\mingw53_32\bin)

第1章 数据库系统概述

第1章 数据库系统概述 1.1 数据库系统简介 数据库技术的发展历史 人工管理阶段文件系统阶段数据库系统阶段

浅谈多线程和异步

最近很忙&#xff0c;因此拿出时间来写博客也算是忙里偷闲了&#xff0c;继承前面的一贯风格&#xff0c;继续浅谈胡侃。  最近在项目中遇到了Socket异步网络传输的问题&#xff0c;所以沉下心来整理下。于是&#xff0c;先问了下度娘&#xff0c;结果找到了园友志良的一篇文…

查看Sql Server的log文件大小

SELECT DB_NAME(database_id) AS DatabaseName,Name AS Logical_Name,Physical_Name, (size*8)/1024 SizeMBFROM sys.master_filesWHERE DB_NAME(database_id) AdventureWorksGO 转载于:https://www.cnblogs.com/top5/archive/2010/03/02/1676776.html

python调用带参函数_Python | 带有示例的函数调用类型

python调用带参函数There are following types of function calls in python: python中有以下类型的函数调用&#xff1a; Call by value 按价值致电 Call by reference 通过参考电话 1)按价值致电 (1) Call by value ) When, we call a function with the values i.e. pass …

ffmpeg 命令添加文字水印

使用ffplay 预览一下效果&#xff1a; ffplay -i cctvhttp.flv -vf “drawtextfontsize100:fontfileArial.ttf:tex t‘hello world’:x20:y20:fontcolorblue:alpha0.5” -x 640 -y 480 使用ffmpeg保存为文件 &#xff1a; ffmpeg -i cctvhttp.flv -vf “drawtextfontsize10…