-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStringDemo.java
More file actions
38 lines (31 loc) · 812 Bytes
/
StringDemo.java
File metadata and controls
38 lines (31 loc) · 812 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package com.string;
/**
* @Auther: Administrator
* @Date: 2019\10\28 0028 23:14
* @Description:
*/
public class StringDemo {
public static void main(String[] args) {
stringToInt();
stringToDouble();
}
public static void stringToInt(){
String test="123";
Integer number=Integer.parseInt(test);
System.out.println(number);
}
public static void stringToDouble(){
Double value3=new Double("1.23");
String test="1.23";
Double number=Double.valueOf(test);
System.out.println(number);
}
public static void stringToInteger(){
String test="123";
Integer number=Integer.valueOf(test);
}
public static void intToLong(){
int number=1;
long longNumber=(long)number;
}
}