当前位置:网站首页>Packaging_ Conversion between basic type and string type
Packaging_ Conversion between basic type and string type
2022-06-24 20:57:00 【Platonic】
Basic types --> character string
1. Value of basic type data +"" The easiest way ( Often used in work )
2. Use static methods in the wrapper class
* static string tostring(int i) : Returns a... That represents a specified integer string object
* 3. Use string Static methods in a class
static string valueof(int i) : return int String representation of parameter
character string --> Basic types
Use static methods of wrapper classes parseXX(" character string 0");
Integer class :static int parseInt(String s)
Double class :static double parseDouble(String s)
Just code examples :public class Demo03Integer {
public static void main(String[] args) {
// Basic types --> character string
String s1=100+"";
System.out.println(s1+200);
String s = Integer.toString(10);
System.out.println(s+200);
String integer = String.valueOf(200);
System.out.println(integer+200);
// character string --> Basic types
int i = Integer.parseInt("1");
System.out.println(i+200);
}
}
100200
10200
200200
201Results, :
边栏推荐
- 图像PANR
- Smooth live broadcast | analysis of key technologies for live broadcast pain points
- 建立自己的网站(14)
- The AI for emotion recognition was "harbouring evil intentions", and Microsoft decided to block it!
- It is said that Tencent officially announced the establishment of "XR" department to bet on yuanuniverse; Former CEO of Google: the United States is about to lose the chip competition. We should let T
- The Network Security Review Office launched a network security review on HowNet, saying that it "has a large amount of important data and sensitive information"
- Bytebase加入阿里云PolarDB开源数据库社区
- Leetcode (455) - distribute cookies
- Two fellow countrymen from Hunan have jointly launched a 10 billion yuan IPO
- Openvino2022 dev tools installation and use
猜你喜欢

Wechat applet custom tabbar

Dongyuhui is not enough to bring goods to "rescue" live broadcast

Vant component used in wechat applet

Procedural life: a few things you should know when entering the workplace

The difference between RPC and restful

Leetcode (135) - distribute candy

对“宁王”边卖边买,高瓴资本“高抛低吸”已套现数十亿

物联网?快来看 Arduino 上云啦

Handling of garbled JMeter response data - three solutions

物聯網?快來看 Arduino 上雲啦
随机推荐
Smooth live broadcast | analysis of key technologies for live broadcast pain points
Implement the redis simple client customized based on socket
宅男救不了元宇宙
Material management system based on SSM (source code + document + database)
全上链哈希游戏dapp系统定制(方案设计)
别再用 System.currentTimeMillis() 统计耗时了,太 Low,StopWatch 好用到爆!
Bridging mode -- law firm
Batch capitalization of MySQL table names
Why do we always "give up halfway"?
[suggested collection] time series prediction application and paper summary
Leetcode (455) - distribute cookies
Bytebase加入阿里云PolarDB开源数据库社区
opds sql组件能不能将流程参数通过上下文传给下一个组件
实现基于Socket自定义的redis简单客户端
Basic concepts and definitions of Graphs
Hosting service and SASE, enjoy the integration of network and security | phase I review
Design of routing service for multi Activity Architecture Design
海泰前沿技术|隐私计算技术在医疗数据保护中的应用
年轻人捧红的做饭生意经:博主忙卖课带货,机构月入百万
Can the OPDS SQL component pass process parameters to the next component through context