<%@ page contentType="text/html; charset=gb2312" %><!-- JSP指令标签 -->
<%@ page import="java.util.*" %> <!-- JSP指令标签 -->
<html> <!-- html标记符 -->
<body>
<% // 以下为java程序片
boolean booleanTemp=true;
Boolean BooleanTemp=new Boolean(false);
byte byteTemp=80;
Byte ByteTemp=new Byte(byteTemp);
char charTemp='c';
Character CharacterTemp=new Character(charTemp);
int intTemp=234;
Integer IntegerTemp=new Integer(intTemp);
short shortTemp=235;
Short ShortTemp=new Short(shortTemp);
long longTemp=1234567;
Long LongTemp=new Long(longTemp);
float floatTemp=1.234F;
Float FloatTemp=new Float(floatTemp);
double doubleTemp=1.23E-8;
Double DoubleTemp=new Double(doubleTemp);
out.println("布尔型包装对象BooleanTemp值为:"+BooleanTemp.booleanValue()+"<br>");
out.println("字符型包装对象CharacterTemp值为:"+CharacterTemp.charValue()+"<br>");
out.println("整型包装对象IntegerTemp值为:"+IntegerTemp.intValue()+"<br>");
out.println("短整型包装对象ShortTemp值为:"+ShortTemp.shortValue()+"<br>");
out.println("字节型包装对象ByteTemp值为:"+ByteTemp.byteValue()+"<br>");
out.println("长整型包装对象LongTemp值为:"+LongTemp.longValue()+"<br>");
out.println("单精度包装对象FloatTemp值为:"+FloatTemp.floatValue()+"<br>");
out.println("双精度型包装对象doubleTemp值为:"+doubleTemp+"<br>");
%>
</body> <!-- html标记符 -->
</html>
JSP简单练习-包装类综合应用实例,布布扣,bubuko.com
JSP简单练习-包装类综合应用实例