惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Threat Research - Cisco Blogs
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
V
Vulnerabilities – Threatpost
GbyAI
GbyAI
P
Proofpoint News Feed
L
LINUX DO - 热门话题
P
Palo Alto Networks Blog
A
About on SuperTechFans
T
Tenable Blog
M
MIT News - Artificial intelligence
IT之家
IT之家
I
Intezer
D
DataBreaches.Net
爱范儿
爱范儿
T
Threatpost
C
CERT Recently Published Vulnerability Notes
云风的 BLOG
云风的 BLOG
博客园 - 三生石上(FineUI控件)
WordPress大学
WordPress大学
K
Kaspersky official blog
大猫的无限游戏
大猫的无限游戏
A
Arctic Wolf
Y
Y Combinator Blog
Cyberwarzone
Cyberwarzone
酷 壳 – CoolShell
酷 壳 – CoolShell
D
Darknet – Hacking Tools, Hacker News & Cyber Security
H
Help Net Security
Microsoft Security Blog
Microsoft Security Blog
Spread Privacy
Spread Privacy
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
AWS News Blog
AWS News Blog
博客园 - 聂微东
C
Check Point Blog
S
Securelist
有赞技术团队
有赞技术团队
雷峰网
雷峰网
aimingoo的专栏
aimingoo的专栏
Last Week in AI
Last Week in AI
Stack Overflow Blog
Stack Overflow Blog
MongoDB | Blog
MongoDB | Blog
D
Docker
G
GRAHAM CLULEY
T
The Exploit Database - CXSecurity.com
C
Cybersecurity and Infrastructure Security Agency CISA
T
Tailwind CSS Blog
L
Lohrmann on Cybersecurity
G
Google Developers Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
L
LangChain Blog

博客园 - uu.Net

修改originate使chan_ss7信令传递原被叫 chan_ss7源码分析 chan_ss7中原被叫号码的传递 oracle循环插入数据用于测试 ORA-12154: TNS: 无法解析指定的连接标识符 使用windows route命令来控制双网卡,双网络访问 JVM优化引起的逻辑错误 scribefIre试用手记 mysql长连接和短连接的问题 tomcat入门 Tomcat5部署 logrotate---日志轮转 关于gcc的include问题 Centos 时间同步 How to create a gun c/c++ project modules的管理 asterisk上加载G729 codec MySQL C API的一次调用体验 - uu.Net FTP的主动和被动模式
box & unbox
uu.Net · 2011-08-18 · via 博客园 - uu.Net

object 对象不能直接强制转换为 Integer

object对象可以直接强制转换为String

Integer a = Integer.parseInt(String str)

装箱和拆箱?拆箱是自动的?

八种基本类型不是对系那个,不能作为对象调用其toString()、hashCode()、getClass()、equals()等方法

对八种基本类型,气功了针对每个基本类型的包装类

int ----Integer

char ---Character

float ----Float

double---Double

byte----Byte

short----Short

long---Long

boolean ---Boolean

box 就是基本类型用它们相对应的基本类型包起来,使得他们具有对象的特质。

unbox的方向相反,将引用类型的对象简化为值类型。

在jdk1.5之前,需要手动box and unbox

jdk1.5之后,自动完成。

wrapper 包装类中都有一个重要的静态方法parse,可以将String字符串类型转为相应的基本数据类型,如果字符串中的值不能转换为基本数据类型,则会抛出java.lang.NumberFormatException

public class parseInt {

/**

* @param args

*/

public static void main(String[] args) {

// TODO Auto-generated method stub

int p = 1;

Integer q = new Integer(p);//手动装箱

int m = q.intValue();//手动拆箱

System.out.println("manual box q="+q);

System.out.println("manual unbox m="+m);

int j = 2;

Integer a = j;

int b = a;

System.out.println("auto box a="+a);

System.out.println("auto unbox b="+b);

String str = new String("30i");

try

{

int pp = Integer.parseInt(str);

System.out.println(pp);

}

catch(Exception e)

{

e.printStackTrace();

}

}

}