Java »ù±¾Óï·¨
Java Ò»¹²8ÖÖ»ù±¾ÀàÐÍ£¬4ÖÖÕûÐÍ£¬2ÖÖ¸¡µãÀàÐÍ£¬1ÖÖ±íʾunicode±àÂëµÄ×Ö·ûµ¥ÔªµÄ×Ö·ûÀàÐÍchar£¬1ÖÖ±íʾÕæÖµµÄbooleanÀàÐÍ¡£
4ÖÖÕûÊýÀàÐÍ
int, 4 ×Ö½Ú
short£¬2×Ö½Ú
long,8×Ö½Ú
byte£¬1×Ö½Ú
2ÖÖ¸¡µãÀàÐÍ
float£¬4×Ö½Ú£¬ºÜÉÙÇé¿öÊʺÏʹÓÃfloat£¬ÊýÖµÓÐÒ»¸öºó׺F,ûÓкó׺µÄ¸¡µãÊýֵĬÈÏΪdouble.Ò²¿ÉÒÔÔÚ¸¡µãÊýÖµºóÃæÌí¼Óºó׺DÔòÊÇdoubleÀàÐÍÁË
double£¬8×Ö½Ú
¼ÆËãÖУ¬ÓÃÀ´±íʾÒç³öºÍ³ö´íÇé¿öµÄ3¸öÌØÊ⸡µãÊýÖµ£¬ÕýÎÞÇî´ó£¬¸ºÎÞÇî´ó£¬NaN(²»ÊÇÒ»¸öÊý×Ö) ²»ÄÜÕâÑùÀ´¼ì²âÊDz»ÊÇÒ»¸öÊý×Ó£¬X==Double.NaN£¬ÒòΪ·ÇÊýÖµµÄÖµ¶¼ÈÏΪÊDz»ÏàͬµÄ¡£¿ÉÒÔÓÃDouble.isNaNÀ´¼ì²â¡£
CharÀàÐÍÓÃÓÚ±íʾµ¥¸ö×Ö·û£¬Í¨³£À´±íʾ×Ö·û³£Á¿£¬'A' ÊDZàÂëΪ65Ëù¶ÔÓ¦µÄ×Ö·û³£Á¿,"A"ÊDZíʾһ¸ö×Ö·û´®¡£ÔÀ´Éè¼ÆunicodeµÄʱºòÈÏΪ16λ¿ÉÒÔ±íʾȫ²¿µÄ×Ö·û£¬µ«ÊÇ×Ô´ÓÔö¼ÓÁ˺ܶàÑÇÖÞÎÄ×Öºó£¬16λ¾Í²»¹»ÓÃÁË£¬ËùÒÔ16λchar¾ÍÃèÊöËùÓеÄunicodeµÄÐèÒªÁË¡£Ç¿ÁÒ½¨Òé²»ÒªÔÙ³ÌÐòÖÐʹÓÃcharÀàÐÍ¡£³ý·ÇȷʵÐèÒªÕë¶ÔUTF16´úÂëµ¥Ôª½øÐвÙ×÷¡£
ÔËËã·û
µ±²ÎÓë³ý·¨ÔËËãµÄÁ½¸ö²Ù×÷Êý¶¼ÊÇÕûÊýʱ£¬¾Í±íʾÕûÊý³ý·¨£¬·ñÔò±íʾ¸¡µã³ý·¨¡£
×ÔÔöÔËËã·û£¬×Ô¼õÔËËã·û
ÔÚ±í´ïʽÖУ¬Ç°×ººó׺·½Ê½ÓÐËùÇø±ð£¬Ç°×ºÊÇÏȽøÐмÓÒ»»ò¼õһȻºóÔٲμÓÔËË㣬ºó׺ÊÇʹÓñäÁ¿ÔÀ´µÄÖµ£¬È»ºó²ÎÓëÔËËãÍê±ÏºóÔÙ¼ÓÒ»¼õÒ»£¬ÆäËûÇé¿ö¶¼Ò»Ñùǰ׺ºó׺¡£
λÔËËã
& | ^ ~ ±íʾÓ룬»òÒì»ò£¬·Ç¡£ËûÃǶ¼ÊÇÔÚλģʽϹ¤×÷µÄ¡£<<>>Ïò×óÏòÓÒ½«¶þ½øÖÆλ½øÐÐ×óÒÆ£¬ÓÒÒÆ¡£>>>ÓÃ0Ìî³ä¸ß룬>>Ó÷ûºÅλÌî³ä¸ßλ¡£
ÊýÖµÀàÐÍÖ®¼äµÄת»»
ʵÐļýÍ·±íʾת»»Ã»ÓÐÐÅÏ¢Ëðʧ£¬·ñÔò¾ÍΪ¾«¶È¿ÉÄÜËðʧ¡£
2ÔªÔËËãµÄʱºò£¬ÒªÏȽ«Á½¸ö²Ù×÷Êýת»»ÎªÍ¬Ò»ÀàÐÍ:
Èç¹ûÁ½¸ö²Ù×÷ÊýÓÐÒ»¸öÊÇdouble£¬ÄÇôÁíÍâÒ»¸ö²Ù×÷Êý»á±»×ª»¯Îªdouble¡£
Èç¹ûÆäÖÐÒ»¸öÊÇfloat£¬ÄÇôÁíÍâÒ»¸ö½«Îª×ªÎªfloat.
Èç¹ûÆäÖÐÒ»¸öÊÇlong,ÄÇôÁíÍâÒ»¸ö¾Íת»¯Îªlong.
·ñÔòÁ½¸ö²Ù×÷Êý¶¼±»×ª»¯Îªint.
ÉÏÃæËÄÖÖת»»²»ÊÇÇ¿ÖÆÐÔ£¬Èç¹û´ÓdoubleÍùint¾ÍÊÇҪǿÖÆת»»(int)
ö¾ÙÀàÐÍ
enum size{SMALL, MEDIUM,LARGE,EXTRA_LARGE}
ÉùÃ÷ÕâÑùÒ»ÖÖÀàÐ͵ıäÁ¿
Size s = Size.MEDIUM;
±äÁ¿ÀïÃæÖ»Äܴ洢ö¾ÙµÄÖµ£¬»òÕßnull£¬±íʾÕâ¸ö±äÁ¿Ã»ÓÐÉèÖÃÈκÎÒ»¸öÖµ
¼ìÑé×Ö·û´®ÊÇ·ñÏàµÈ
Ò»¶¨²»ÄÜʹÓÃ==¼ì²âÁ½¸ö×Ö·û´®ÏàµÈ£¬Õâ¸öÖ»Äܼì²âÁ½¸ö×Ö·û´®ÊÇ·ñ·ÅÔÚͬһ¸öλÖÃÉÏ¡£µ±È»Èç¹ûÔÚͬһλÖã¬Ó¦¸ÃÏàµÈ£¬µ«ÊÇÒ²ÓпÉÄܽ«ÄÚÈÝÏàͬµÄ¶à¸ö×Ö·û´®µÄ¿½±´·ÅÖÃÔÚ²
Ïà¹ØÎĵµ£º
µÚ1Ìõ How to Write an Equality Method in Java
http://www.artima.com/lejava/articles/equality.html
How to Write an Equality Method in Java
by Martin Odersky, Lex Spoon, and Bill Venners
June 1, 2009
Summary
This article describes a technique for overriding the equals method t ......
¹ØÓÚvolatile
ÎÒÃÇÖªµÀ£¬ÔÚJavaÖÐÉèÖñäÁ¿ÖµµÄ²Ù×÷£¬³ýÁËlongºÍdoubleÀàÐ͵ıäÁ¿ÍⶼÊÇÔ×Ó²Ù×÷£¬Ò²¾ÍÊÇ˵£¬¶ÔÓÚ±äÁ¿ÖµµÄ¼òµ¥¶Áд²Ù×÷ûÓбØÒª½øÐÐͬ²½¡£
ÕâÔÚJVM 1.2֮ǰ£¬JavaµÄÄÚ´æÄ£ÐÍʵÏÖ×ÜÊÇ´ÓÖ÷´æ¶ÁÈ¡±äÁ¿£¬ÊDz»ÐèÒª½øÐÐÌرðµÄ×¢ÒâµÄ¡£¶øËæ×ÅJVMµÄ³ÉÊìºÍÓÅ»¯£¬ÏÖÔÚÔÚ¶àÏ̻߳·¾³ÏÂ
volatile¹Ø¼ü×ÖµÄʹÓñäµÃ·Ç³£ÖØ ......
public class SplitString {
/**
* @param args
*/
public static void main(String[] args) {
String str = "ÖÐZellÖйú5000Äê,Congruations!";
& ......
×òÌìдÁËÓÃÃæÏò¶ÔÏóµÄ˼ÏëÈ¥·ÖÎöÒ»¸öʵ¼ÊµÄÎÊÌ⣬ºÇºÇ£¬ÄÇô½ñÌì¾Í¾ÍÀàºÍ¶ÔÏó×öÒ»¸öÏêϸµÄÌÖÂÛ¡£
×òÌì˵ÁËÔÚCSÖÐÈËÎï¿ÉÄÜÊÇÒ»¸ö³éÏóÀà»òÒ»¸ö½Ó¿Ú£¬¶ø¸÷ÖÖ¸÷ÑùµÄÈËÎï¾ÍÊǼ̳лòʵÏÖÁËÕâ¸ö½Ó¿Ú£¬¶ø˵µ½ÕâÀïÎÒÃÇ»¹ÔÚÌÖÂÛÀ࣬»¹Ã»ÓÐÉæ¼°µ½¶ÔÏó£¬ÄÇôʲôʱºò²úÉúµÄ¶ÔÏóÄØ£¿ÄÇÊÇÔ۵ǽÁËCSºóÑ¡ÔñÁËÒ»¸öÈËÎȻºóÔÙÎÒÃÇÑ¡ºÃµÄͬ ......