Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Java½â»ó1 2ÕÒÁãʱ¿Ì

Ç뿼ÂÇÏÂÃæÕâ¶Î»°ËùÃèÊöµÄÎÊÌ⣺
TomÔÚÒ»¼ÒÆû³µÅä¼þÉ̵깺ÂòÁËÒ»¸ö¼ÛÖµ$1.10µÄ»ð»¨Èû£¬µ«ÊÇËûÇ®°üÖж¼ÊÇÁ½ÃÀÔªÒ»Õŵij®Æ±¡£Èç¹ûËûÓÃÒ»ÕÅÁ½ÃÀÔªµÄ³®Æ±Ö§¸¶Õâ¸ö»ð»¨Èû£¬ÄÇôӦ¸ÃÕÒ¸øËû¶àÉÙÁãÇ®ÄØ£¿
ÏÂÃæÊÇÒ»¸öÊÔͼ½â¾öÉÏÊöÎÊÌâµÄ³ÌÐò£¬Ëü»á´òÓ¡³öʲôÄØ£¿
public class Change{
public static void main(String args[]){
System.out.println(2.00 - 1.10);
}
}
Äã¿ÉÄÜ»áºÜÌìÕæµØÆÚÍû¸Ã³ÌÐòÄܹ»´òÓ¡³ö0.90£¬µ«ÊÇËüÈçºÎ²ÅÄÜÖªµÀÄãÏëÒª´òӡСÊýµãºóÁ½Î»Ð¡ÊýÄØ£¿
Èç¹ûÄã¶ÔÔÚDouble.toStringÎĵµÖÐËùÉ趨µÄ½«doubleÀàÐ͵Äֵת»»Îª×Ö·û´®µÄ¹æÔòÓÐËùÁ˽⣬Äã¾Í»áÖªµÀ¸Ã³ÌÐò´òÓ¡³öÀ´µÄСÊý£¬ÊÇ×ãÒÔ½«doubleÀàÐ͵ÄÖµÓë×î¿¿½üËüµÄÁÙ½üÖµÇø·Ö³öÀ´µÄ×î¶ÌµÄСÊý£¬ËüÔÚСÊýµã֮ǰºÍÖ®ºó¶¼ÖÁÉÙÓÐһλ¡£Òò´Ë£¬¿´ÆðÀ´£¬¸Ã³ÌÐòÓ¦¸Ã´òÓ¡0.9ÊǺÏÀíµÄ¡£
Õâô·ÖÎö¿ÉÄÜÏԵúܺÏÀí£¬µ«ÊDz¢²»ÕýÈ·¡£Èç¹ûÄãÔËÐиóÌÐò£¬Äã¾Í»á·¢ÏÖËü´òÓ¡µÄÊÇ0.8999999999999999¡£
ÎÊÌâÔÚÓÚ1.1Õâ¸öÊý×Ö²»Äܱ»¾«È·±íʾ³ÉΪһ¸ödouble£¬Òò´ËËü±»±íʾ³ÉΪ×î½Ó½üËüµÄdoubleÖµ¡£¸Ã³ÌÐò´Ó2ÖмõÈ¥µÄ¾ÍÊÇÕâ¸öÖµ¡£Òź¶µÄÊÇ£¬Õâ¸ö¼ÆËãµÄ½á¹û²¢²»ÊÇ×î½Ó½ü0.9µÄdoubleÖµ¡£±íʾ½á¹ûµÄdoubleÖµµÄ×î¶Ì±íʾ¾ÍÊÇÄãËù¿´µ½µÄ´òÓ¡³öÀ´µÄÄǸö¿É¶ñµÄÊý×Ö¡£
¸üÒ»°ãµØ˵£¬ÎÊÌâÔÚÓÚ²¢²»ÊÇËùÓеÄСÊý¶¼¿ÉÒÔÓöþ½øÖƸ¡µãÊýÀ´¾«È·±íʾµÄ¡£
Èç¹ûÄãÕýÔÚÓõÄÊÇJDK 5.0»ò¸üеİ汾£¬ÄÇôÄã¿ÉÄÜ»áÊÜÆäÓÕ»ó£¬Í¨¹ýʹÓÃprintf¹¤¾ßÀ´ÉèÖÃÊä³ö¾«¶ÈµÄ·½¶©Õý¸Ã³ÌÐò£º
//×¾ÁӵĽâ¾ö·½°¸——ÈÔ¾ÉÊÇʹÓöþ½øÖƸ¡µãÊý
System.out.printf("%.2f%n",2.00 - 1.10);
ÕâÌõÓï¾ä´òÓ¡µÄÊÇÕýÈ·µÄ½á¹û£¬µ«ÊÇÕâ²¢²»±íʾËü¾ÍÊǶԵײãÎÊÌâµÄͨÓýâ¾ö·½°¸£ºËüʹÓõÄÈÔ¾ÉÊǶþ½øÖƸ¡µãÊýµÄdoubleÔËËã¡£¸¡µãÔËËãÔÚÒ»¸ö·¶Î§ºÜ¹ãµÄÖµÓòÉÏÌṩÁ˺ܺõĽüËÆ£¬µ«ÊÇËüͨ³£²»ÄܲúÉú¾«È·µÄ½á¹û¡£¶þ½øÖƸ¡µã¶ÔÓÚ»õ±Ò¼ÆËãÊǷdz£²»Êʺϵģ¬ÒòΪËü²»¿ÉÄܽ«0.1——»òÕß10µÄÆäËüÈκδθºÃÝ——¾«È·±íʾΪһ¸ö³¤¶ÈÓÐÏ޵Ķþ½øÖÆСÊý
½â¾ö¸ÃÎÊÌâµÄÒ»ÖÖ·½Ê½ÊÇʹÓÃijÖÖÕûÊýÀàÐÍ£¬ÀýÈçint»òlong£¬²¢ÇÒÒÔ·ÖΪµ¥Î»À´Ö´ÐмÆËã¡£Èç¹ûÄã²ÉÄÉÁË´Ë·Ïߣ¬ÇëÈ·±£¸ÃÕûÊýÀàÐÍ´óµ½×ã¹»±íʾÔÚ³ÌÐòÖÐÄ㽫ҪÓõ½µÄËùÓÐÖµ¡£¶ÔÕâÀï¾ÙÀýµÄÃÕÌâÀ´Ëµ£¬int¾Í×ã¹»ÁË¡£ÏÂÃæÊÇÎÒÃÇÓÃintÀàÐÍÀ´ÒÔ·ÖΪµ¥Î»±íʾ»õ±ÒÖµºóÖØдµÄprintlnÓï¾ä¡£Õâ¸ö°æ±¾½«´òÓ¡³öÕýÈ·´ð°¸90·Ö£º
System.out.println((200 - 110) + "cents");
½â¾ö¸ÃÎÊÌâµÄÁíÒ»ÖÖ·½Ê½ÊÇÊ


Ïà¹ØÎĵµ£º

JavaÖм¯ºÏÈÝÆ÷ÀàListºÍSetµÄÓ÷¨

ListµÄÓ÷¨
List°üÀ¨List½Ó¿ÚÒÔ¼°List½Ó¿ÚµÄËùÓÐʵÏÖÀà¡£ÒòΪList½Ó¿ÚʵÏÖÁËCollection½Ó¿Ú£¬ËùÒÔList½Ó¿ÚÓµÓÐCollection½Ó¿ÚÌṩµÄËùÓг£Ó÷½·¨£¬ÓÖÒòΪListÊÇÁбíÀàÐÍ£¬ËùÒÔList½Ó¿Ú»¹ÌṩÁËһЩÊʺÏÓÚ×ÔÉíµÄ³£Ó÷½·¨£¬Èç±í1Ëùʾ¡£
±í1  List½Ó¿Ú¶¨ÒåµÄ³£Ó÷½·¨¼°¹¦ÄÜ
´Ó±í1¿ÉÒÔ¿´³ö£¬List½Ó¿ÚÌṩµÄÊʺÏÓÚ×ÔÉíµÄ ......

javaÖÐStringÓëStringBufferµÄÇø±ð

ÔÚjavaÖÐÓÐ3¸öÀàÀ´¸ºÔð×Ö·ûµÄ²Ù×÷¡£
 
1.Character ÊǽøÐе¥¸ö×Ö·û²Ù×÷µÄ£¬
 
2.String ¶ÔÒ»´®×Ö·û½øÐвÙ×÷¡£²»¿É±äÀà¡£
 
3.StringBuffer Ò²ÊǶÔÒ»´®×Ö·û½øÐвÙ×÷£¬µ«ÊǿɱäÀà¡£
 
String:
ÊǶÔÏó²»ÊÇԭʼÀàÐÍ.
Ϊ²»¿É±ä¶ÔÏó,Ò»µ©±»´´½¨,¾Í²»ÄÜÐÞ¸ÄËüµÄÖµ.
¶ÔÓÚÒѾ­´æÔÚµÄString¶ÔÏóµÄÐÞ¸ ......

JAVA²Ù×÷XMLµÄÍêÕûÀý×Ó——W3C DOMƪ

ÕâÊÇÒ»¸öÓÃJAVA W3C DOM ½øÐÐXML²Ù×÷µÄÀý×Ó£¬°üº¬Á˲éѯ¡¢Ôö¼Ó¡¢Ð޸ġ¢É¾³ý¡¢±£´æµÄ»ù±¾²Ù×÷¡£½ÏÍêÕûµÄÃèÊöÁËÒ»¸öXMLµÄÕû¸ö²Ù×÷Á÷³Ì¡£ÊʺϸÕÈëÃÅJAVA XML²Ù×÷µÄÅóÓѲο¼ºÍѧϰ¡£
¼ÙÉèÓÐXMLÎļþ£ºtest1.xml
<?xml version="1.0" encoding="UTF-8"?>
<books>
 <book>
  <name>¹þÀï²¨Ì ......

java.lang.reflect.Method £¨java·´Éä»úÖÆ£©

¹«Ë¾Vac·½·¨¹ýÂËÆ÷ʹÓõ½·´Éä»úÖÆ£¬¶ÁÈ¡xmlÅäÖÃÎļþ¹ýÂËÓû§·ÃÎʵķ½·¨ÃûÊÇ·ñºÏ·¨¡£
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        HttpServletRequest httpRequest = (HttpServletRe ......

JAVA SE ÖеÄFile

 import java.io.File;

public class FileTest{
public static void main(String[] args){
scan("c:/file/ss");
}
public static void scan(String path){
if(path ==null)
return ;
File file = new File(path); //É ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ