JavaÖеÄÀàÐÍת»»
±¾×÷Æ·²ÉÓÃ֪ʶ¹²ÏíÊðÃû-·ÇÉÌÒµÐÔʹÓÃ-Ïàͬ·½Ê½¹²Ïí 2.5 Öйú´ó½Ðí¿ÉÐÒé½øÐÐÐí¿É¡£
ÎÞÂÛÔÚC/C++»¹ÊÇÔÚJava£¬Ç¿ÖÆÀàÐÍת»»ÒѾ²»ÊÇÄ°ÉúµÄ¸ÅÄîÁË¡£µ«ÊÇÒªÏëÈ«ÃæÕÆÎÕJavaÖÐÀàÐÍת»»µÄÒªµã¿É²»ÄÇô¼òµ¥£¬±¾ÎĽ«´øÁì´ó¼ÒһͬÁ˽âÓйØJavaÀàÐÍת»»µÄËùÓÐÒªµã¡£
ÊýÖµÀàÐ͵ÄÀàÐÍת»»
ÖÚËùÖÜÖª£¬JavaÓÐÁ½ÖÖÊý¾ÝÀàÐÍ£º»ù±¾Êý¾ÝÀàÐÍÓëÒýÓÃÊý¾ÝÀàÐÍ£»JavaÓÖÓÐÁ½ÖÖ»ù±¾µÄÀàÐÍת»»ÔÔò£ºÍØ¿íת»»ÔÔò£¨widening conversion£©ÓëËõСת»»ÔÔò£¨narrowing conversion£©¡£
ÍØ¿íת»»ÓëËõСת»»Ö»ÊÊÓÃÓÚ»ù±¾Êý¾ÝÀàÐÍÖеÄÊýÖµÀàÐÍ¡£Êý¾ÝÖµÀàÐÍ°´ÕÕ·¶Î§´ÓСµ½´óÅÅÁÐΪ£º
byte short int long float double
µ±Ä¿±êÀàÐ͵ķ¶Î§±ÈÔ´ÀàÐ͵ķ¶Î§´óʱ×ñÑÍØ¿íת»»ÔÔò£¬²»±ØÇ¿ÖÆת»»¡£È磺
byte b = 10;
short s = b;
·´Ö®Ôò×ñÑËõСת»»ÔÔò£¬¼´
µ±Ä¿±êÀàÐ͵ķ¶Î§±ÈÔ´ÀàÐ͵ķ¶Î§Ð¡Ê±×ñÑËõСת»»ÔÔò£¬±ØÐëÇ¿ÖÆת»»¡£È磺
short s = 10;
byte b = (byte)s;
ÐèҪעÒâµÄÊÇÍØ¿íת»»ÔÔò²»¶ªÊ§Êý¾Ý¡£È磺
long l1 = Long.MAX_VALUE;
float f = l1;
long l2 = (long)f;
System.out.println("ת»»Ç°£º" + l1);
System.out.println("ת»»ºó£º" + l2);
ÉÏÀýÊä³ö½á¹ûΪ£º
ת»»Ç°£º9223372036854775807
ת»»ºó£º9223372036854775807
ËõСת»»ÔÔòÔÚ³¬³öÄ¿±êÀàÐ͵ÄÈ¡Öµ·¶Î§Ê±»áµ¼ÖÂÊý¾Ý¶ªÊ§¡£È磺
int i1 = 257;
byte b = (byte)i1;
int i2 = b;
System.out.println("ת»»Ç°£º" + i1);
System.out.println("ת»»ºó£º" + i2);
ÉÏÀýÊä³ö½á¹ûΪ£º
ת»»Ç°£º257
ת»»ºó£º1
×Ö·ûÀàÐÍÓëÊýÖµÀàÐÍÖ®¼äµÄת»»
»ù±¾Êý¾ÝÀàÐÍcharµÈͬÓÚÒ»¸öÎÞ·ûºÅ¶ÌÕûÐÍ£¬·¶Î§´Ó0x0000µ½0xFFFF¡£
´ÓÆäËüÊýÖµÀàÐÍת»»µ½charÀàÐÍʱ£¬±ØÐë½øÐÐÇ¿ÖÆת»»¡£È磺
byte b = 10;
short s = 10;
int i = 10;
long l = 10L;
float f = 10.0F;
double d = 10.0;
char c = (char)b;
c = (char)s;
c = (char)i;
c = (char)l;
c = (char)f;
c = (char)d;
½«charÀàÐÍת»»³ÉÆäËüÊýÖµÀàÐÍʱ£¬³ýbyte¡¢short±ØÐëÇ¿ÖÆת»»Í⣬int long float double¾ù²»±ØÇ¿ÖÆת»»¡£È磺
char c = 'a';
byte b = (byte)c;
short s = (byte)c;
int i = c;
long l = c;
float f = c;
double d = c;
ÒýÓÃÀàÐ͵ÄÀàÐÍת»»
ÒýÓÃÀàÐ͵ĸ³Öµ³£¼ûÓÚ¾ßÓм̳йØϵµÄÁ½ÖÖÀàÐ͵Äת»»¡£ÈçÏÂÃæµÄÀý×Ó£º
public class Person {
p
Ïà¹ØÎĵµ£º
public boolean writeXML(String content, String filename)
{
String savepath;
FileOutputStream fout;
// log.info("content:"+content+ ......
¹Ø¼ü×Ö: java.e800.com.cn/articles/2007/413/1176400876794405339_1.htm
http://java.e800.com.cn/articles/2007/413/1176400876794405339_1.html
±àÕß°´£ºJavaÄÚ´æй©ÊÇÿ¸öJava³ÌÐòÔ±¶¼»áÓöµ½µÄÎÊÌ⣬³ÌÐòÔÚ±¾µØÔËÐÐÒ»ÇÐÕý³££¬¿ÉÊDz¼Êðµ½Ô¶¶Ë¾Í»á³öÏÖÄÚ´æÎÞÏÞÖƵÄÔö³¤£¬×îºóϵͳ̱»¾£¬ÄÇôÈçºÎ×î¿ì×îºÃµÄ¼ì²â³ÌÐòµÄÎ ......
Ä¿Ç°JAVA2ÓÐÈý¸ö°æ±¾£ºJ2EE£¨ÆóÒµ°æ£©¡¢J2SE£¨±ê×¼°æ£©¡¢J2ME£¨Î¢ÐͰ棩
1¡¢J2SE£¨JAVA2 Standart Edition£©
JAVA2±ê×¼°æ Ö§³ÖËùÓÐJAVA±ê×¼¹æ·¶ÖÐËù¶¨ÒåµÄºËÐÄÀຯÊý¿âºÍËùÓеÄJAVA»ù±¾Àà±ð¡£J2SE¶¨Î»ÔÚ¿Í»§¶Ë³ÌÐòµÄÓ¦ÓÃÉÏ¡£
2¡¢J2EE£¨JAVA2 Enterprise Edition£©
......
´óѧµÄʱºòÑ¡ÐÞ¹ýÒ»¸öѧÆÚÈÕÓµ±Ê±ÈÕÓïÀÏʦ¶ÔÎÒÃÇ˵£º“¶ÔÓÚÖйúÈËÀ´½²£¬Ñ§Ï°Ó¢ÓïÒ»°ãÊÇ¿Þ׎øÈ¥£¬Ð¦×ųöÀ´£»Ñ§Ï°ÈÕÓïÔòÊÇЦ׎øÈ¥£¬¿Þ×ųöÀ´”¡£Òâ˼¾ÍÊÇ˵ѧϰӢÓïµÄʱºò£¬ÈëÃŵÄʱºò±È½ÏÀ§ÄÑ£¬µ«ÊÇÖ»Òª¼á³ÖѧÏÂÈ¥£¬×ª±äÁ˺ºÓïµÄ˼άϰ¹ßʱ£¬×î½ü¿ÉÒÔ°ÑÓ¢ÓïѧµÃºÜºÃ¡£¶øÈÕÓﲻͬ£¬Ò»·½ÃæÒòΪÆäÓ뺺ÓïµÄ½ôÃÜ¹Ø ......