MCPcopy Create free account
hub / github.com/TonyD0g/JavaHacker / main

Method main

0 Java开发基础/0.UDF/StringToNumber.java:4–13  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

2
3public class StringToNumber {
4 public static void main(String[] args){
5 //Sting 转 double
6 String str1 = "30.1";
7 double num1 = Double.parseDouble(str1);
8 System.out.println(num1);
9 //Sting 转 int
10 String str2 = "30";
11 int num2 = Integer.parseInt(str1);
12 System.out.println(num1);
13 }
14
15
16}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected