forked from code-toan-bug/java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathParsingDemo.java
More file actions
22 lines (20 loc) · 760 Bytes
/
ParsingDemo.java
File metadata and controls
22 lines (20 loc) · 760 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
public class ParsingDemo {
public static void main(String[] args) {
String strInt = "456";
int num = Integer.parseInt(strInt);
String strDouble = "3.14";
double num1 = Double.parseDouble(strDouble);
String strFloat = "2.718";
float num2 = Float.parseFloat(strFloat);
String strLong = "3476543210";
long num3 = Long.parseLong(strLong);
String strBoolean = "true";
boolean isTrue = Boolean.parseBoolean(strBoolean);
String strName = "madan";
boolean isName = Boolean.parseBoolean(strName);
String hello = "Hello";
char firstChar = hello.charAt(0);
char[] charArray = hello.toCharArray();
char secondChar = charArray[1];
}
}