makefile Ö® java X Ö® lint
E:\>javac -X
-Xlint ÆôÓý¨ÒéµÄ¾¯¸æ
-Xlint:{all,deprecation,unchecked,fallthrough,path,serial,finally,-deprecat ion
,-unchecked,-fallthrough,-path,-serial,-finally}ÆôÓûò½ûÓÃÌØ¶¨µÄ¾¯¸æ
-Xbootclasspath/p:<·¾¶> ÖÃÓÚÒýµ¼Àà·¾¶Ö®Ç°
-Xbootclasspath/a:<·¾¶> ÖÃÓÚÒýµ¼Àà·¾¶Ö®ºó
-Xbootclasspath:<·¾¶> ¸²¸ÇÒýµ¼ÀàÎļþµÄλÖÃ
-Djava.ext.dirs=<Ŀ¼> ¸²¸Ç°²×°µÄÀ©Õ¹Ä¿Â¼µÄλÖÃ
-Djava.endorsed.dirs=<Ŀ¼> ¸²¸ÇÇ©ÃûµÄ±ê׼·¾¶µÄλÖÃ
-Xmaxerrs <±àºÅ> ÉèÖÃÒªÊä³öµÄ´íÎóµÄ×î´óÊýÄ¿
-Xmaxwarns <±àºÅ> ÉèÖÃÒªÊä³öµÄ¾¯¸æµÄ×î´óÊýÄ¿
-Xstdout <ÎļþÃû> ÖØ¶¨Ïò±ê×¼Êä³ö
ÕâЩѡÏî¶¼ÊǷDZê׼ѡÏעÒâ¸üС£¡£¡£
ÎÒÃÇÒÀ´ÎÀ´¿´¿´ÆäÖÐÉæ¼° lint µÄÑ¡Ï
-Xlint
ÆôÓÃËùÓо¯¸æ¡£¸ÃÑ¡ÏîÏ൱ÓÚ -Xlint:all Ñ¡Ïî¡£Ïà·´£¬¹Ø±ÕËùÓо¯¸æµÄÑ¡ÏîΪ -Xlint:none¡£
-Xlint:unchecked
ÆôÓöÔËùνµÄδ¾¼ì²éµÄת»»£¨unchecked warning£©µÄ¾¯¸æ¡£Õâ¸ö¾¯¸æÉæ¼° JDK 5.0 ÖеÄÐÂÌØÐÔ——·¶ÐÍ£¨Generic
Type£©£¬Õâ¾ø¶ÔÊÇÁíÍâÒ»¸ö¹ÊÊÂÁË¡£ÓÐÐËȤµÄ»°£¬¿ÉÒÔÔÚ Internet ÉÏËÑË÷µ½ºÜ¶à¹ØÓÚ·¶Ð͵ÄÎÄÕ¡£
-Xlint:path
µ±·¢ÏÖ²»´æÔڵķ¾¶»òÕßĿ¼ʱ¸ø³ö¾¯¸æ£¬±ÈÈç±ê׼ѡÏîÖеÄÀà·¾¶£¨classpath£©£¬Ô´´úÂë·¾¶£¨sourcepath£©µÈµÈ¡£
-Xlint:serial
µ±ÔÚ¿ÉÐòÁл¯µÄÀàÖÐûÓз¢ÏÖ serialVersionUID µÄ¶¨Òåʱ£¬¸ø³ö¾¯¸æ¡£
Xlint:finally
µ±·¢ÏÖ finally ×Ó¾äÎÞ·¨Õý³£½áÊøµÄÇé¿öʱ¸ø³ö¾¯¸æ¡£±ÈÈçÏÂÃæÕâ¶Î´úÂ룺
try {
} catch (Exception e) {
} finally {
for (;;);
}
-Xlint:fallthrough
µ±ÔÚ switch Óï¾ä¿éÖз¢ÏÖ fall-through µÄÇéÐÎʱ¸ø³ö¾¯¸æ¡£ÕâÀïËù˵µÄ fall-through ÇéÐÎÖ¸µÄÊÇÔÚ
switchÓï¾ä
Ïà¹ØÎĵµ£º
Thread.currentThread().getName().equals("xxxx") ÕâÌõÓï¾ä·µ»ØÒ»¸ö bool Ð͵Ľá¹û¡£Åжϵ±Ç°ÔËÐеĽø³ÌÊÇ·ñºÍ xxxx µÄÃû×ÖÒ»Ñù¡£
¶¨ÒåÏ̵߳ÄÁ½ÖÖ·½·¨£ºclass a1 extends Thread{ } a1 xiancheng=new a1();
¶þÊÇ£ºÓýӿڻص÷¼¼Êõ¡£ class a1 implements Runnable{ } a1 ......
import
java.util.Random;
/**
*
ÅÅÐò²âÊÔÀà
*
*
ÅÅÐòËã·¨µÄ·ÖÀàÈçÏ£º
*
1.
²åÈëÅÅÐò£¨Ö±½Ó²åÈëÅÅÐò¡¢ÕÛ°ë²åÈëÅÅÐò¡¢Ï£¶ûÅÅÐò£©£»
*
2.
½»»»ÅÅÐò£¨Ã°ÅÝÅÝÅÅÐò¡¢¿ìËÙÅÅÐò£©£»
*
3.
Ñ¡ÔñÅÅÐò£¨Ö±½ÓÑ¡ÔñÅÅÐò¡¢¶ÑÅÅÐò£©£»
  ......
/**
* ´¦Àíʱ¼äÒì³£ Date to String
* Èç¹ûת»»³öÏÖÒì³£»á¸øÄ¬ÈÏÖµ00:00
* @param time
* @param sdf
* @return
*/
public static String handleDateParseException(Object time){
String tempTime = "00:00";
try{
......
Ò»¡¢´Ó¸ù±¾ÉÏÈÏʶjava.lang.StringÀàºÍString³Ø
Ê×ÏÈ£¬ÎÒ½¨ÒéÏÈ¿´¿´StringÀàµÄÔ´ÂëʵÏÖ£¬ÕâÊÇ´Ó±¾ÖÊÉÏÈÏʶStringÀàµÄ¸ù±¾³ö·¢µã¡£´ÓÖпÉÒÔ¿´µ½£º
1¡¢StringÀàÊÇfinalµÄ£¬²»¿É±»¼Ì³Ð¡£public final class String¡£
2¡¢StringÀàÊǵı¾ÖÊÊÇ×Ö·ûÊý×échar[], ²¢ÇÒÆäÖµ²»¿É¸Ä±ä¡£private final char value[];
È»ºó´ò¿ªStr ......
1.servlet²úÉúÑéÖ¤Â룺
package com.servlet;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Random;
import javax.imageio.ImageIO; ......