<html>
<!-- #BeginTemplate "/Templates/empolder-doc.dwt" -->
<head>
<title>|><| 太平洋电脑网 -> 网络学院</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
-->
</style>
<link rel="stylesheet" href="/pcedu/style/text.css">
<script language="JavaScript">
<!--
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
</head>
<body bgcolor="#FFFFFF" topmargin=0 leftmargin=0 marginheight="0" onLoad="MM_preloadImages('/images/lefton.gif','/images/topon.gif')">
<a name="top"></a>
<script language="JavaScript" src="/pcedu/script/top.js">
</script>
<table width=760 border=0 cellspacing=0 cellpadding=0 align=center>
<tr>
<td width=194 height="56"><a href=http://www.pconline.com.cn><img src=http://www.pconline.com.cn/images/pconlinelogo.gif width=162 height=35 vspace=10 border=0></a></td>
<td width=406 height="56">
<script language="JavaScript" src="/pcedu/script/empolder_ad.js">
</script>
</td>
<td width=158 align=right height="56">
<script language="JavaScript" src="/pcedu/script/empolder_ad1.js">
</script>
</td>
<td align=right width=2 height="56"> </td>
</tr>
</table>
<table border=0 cellpadding=0 cellspacing=0 width=760 align="center">
<tbody>
<tr valign=bottom>
<td rowspan=2 width=172><img height=32 src="/pcedu/images/pcedu_lo.gif"
width=172 border="0"></td>
<td height=30 rowspan=2>
<table cellpadding=0 cellspacing=0 width="588" bgcolor="#FFA000" background="/pcedu/images/e_menu5.gif" border="0">
<tbody>
<tr valign="bottom">
<td height="17">
<script language="JavaScript" src="/pcedu/script/title_empolder.js">
</script>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr></tr>
<tr bgcolor="#303880">
<td colspan=2 height=1 valign=bottom><img height=1
src="/pcedu/images/blank.gif" width=1></td>
</tr>
<tr>
<td colspan=2 height=5 valign=bottom><img height=5
src="/pcedu/images/blank.gif" width=1></td>
</tr>
</tbody>
</table>
<table width="760" cellspacing="0" cellpadding="0" align="center" height="614">
<tr>
<td width="170" height="616" valign="top" rowspan="2">
<table border="0" width="170" height="100%"
cellspacing="1" bgcolor="#000000">
<tr bgcolor="#F8F8D2">
<td width="100%" valign="top" height="307">
<script language="JavaScript" src="/pcedu/script/left_empolder.js">
</script>
</td>
</tr>
</table>
</td>
<td width="8" height="308"><img src="/pcedu/images/blank.gif" width="1" height="1"></td>
<td valign="top" height="444" width="582">
<table width="582" border="0" cellspacing="0" cellpadding="0" height="1" background="/images/line5.gif">
<tr>
<td height="1"></td>
</tr>
</table>
<!-- #BeginEditable "content" -->
<table width="582" border="0" cellspacing="8" cellpadding="0" background="/images/bg6.gif">
<tr>
<td valign="top">
<table width="100%" border="0" cellspacing="8" cellpadding="0" background="/images/point.gif">
<tr>
<td height="4" colspan="3"></td>
</tr>
<tr>
<td height="22" colspan="3">
<div align="center" class="title">JAVA程序员必读:基础篇(3)语言基础</div>
</td>
</tr>
<tr valign="bottom">
<td width="90" height="18">
<div align="right" class="gray"> </div>
<div class="gray"></div>
</td>
<td height="18">
<div align="center"><font color="#666666">编译:ZSC/太平洋网络学院</font></div>
</td>
<td width="90">
<div align="right" class="gray"><a href="mailto:tntst@pconline.com.cn">[责编:爆破手]</a></div>
</td>
</tr>
<tr valign="bottom">
<td colspan="3" height="0"></td>
</tr>
</table>
<p class="article"> <b>语言基础</b> </p>
<p></p>
<p class="article"><b>3.1.1 数据类型</b></p>
<p class="article"> 每一个变量必须有一个数据类型。一个变量的数据类型决定了变量能容纳的数值和操作符。比如 ,在MaxVariablesDemo程序中,声明int
largestInteger决定了largestInteger是一个整型数据类型(int)。整型只能容纳整型数(可以是正数也可以是负数)。你可以完成算术操作,比如,整型变量的加法等等。</p>
<p class="article"> JAVA程序语言有两类的数据类型:原始和引用。一个原始类型的变量为它的类型包含了适当大小和格式的单一数值:一个数字、字符或者一个布尔型数值。比如,一个整型数值是一个32位数据。</p>
<p class="article"> 下面表格所有的JAVA支持的所有原始数据类型,还给出了它们的大小和格式以及简短的描述。MaxVariablesDemo程序为每一个原始类型声明了一个变量:</p>
<p> </p>
<table BORDER cellspacing=1 cellpadding=7 width=98% align="center">
<tr>
<td width="33%" valign="TOP">
<p align="CENTER" class="article">关键字
</td>
<td width="33%" valign="TOP">
<p align="CENTER" class="article">描述
</td>
<td width="33%" valign="TOP">
<p align="CENTER" class="article">大小/格式
</td>
</tr>
<tr>
<td valign="TOP" colspan=3>
<p align="CENTER" class="article">整型
</td>
</tr>
<tr>
<td width="33%" valign="TOP">
<p align="CENTER" class="article">byte
</td>
<td width="33%" valign="TOP">
<p align="CENTER" class="article">字节长度整型
</td>
<td width="33%" valign="TOP">
<p align="CENTER" class="article">8位两个补码
</td>
</tr>
<tr>
<td width="33%" valign="TOP">
<p align="CENTER" class="article">Short
</td>
<td width="33%" valign="TOP">
<p align="CENTER" class="article">短整型
</td>
<td width="33%" valign="TOP">
<p align="CENTER" class="article">16位两个补码
</td>
</tr>
<tr>
<td width="33%" valign="TOP">
<p align="CENTER" class="article">int
</td>
<td width="33%" valign="TOP">
<p align="CENTER" class="article">整型
</td>
<td width="33%" valign="TOP">
<p align="CENTER" class="article">32位两个补码
</td>
</tr>
<tr>
<td width="33%" valign="TOP">
<p align="CENTER" class="article">long
</td>
<td width="33%" valign="TOP">
<p align="CENTER" class="articl
评论0