java ×¢ÊÍ : annotations ÔªÊý¾Ý
annotations : ×¢ÊÍ
ºÃ´¦
1.Îĵµ±àÖÆ
2.±àÒëÆ÷¼ì²é
3.´úÂë·ÖÎö
JSR 175 ÊDZà³ÌÓïÑÔµÄÔªÊý¾Ý¹¤¾ß,Ϊ½«ÔªÊý¾ÝºÏ²¢µ½ºËÐÄjavaÓïÑÔÖÐÌṩÕýʽÀíÓɺÍ˵Ã÷
»ù±¾ÖªÊ¶:
×¢ÊͲÉÓÃ"@"±ê¼ÇÐÎʽ,ºóÃæÊÇ×¢ÊÍÃû³Æ,È»ºóÔÚÐèÒªÊý¾Ýʱ,ͨ¹ýname=value¶ÔÏò×¢ÊÍÌṩÊý¾Ý
×¢Ê͵ÄÈý¸ö»ù±¾ÖÖÀà:
±ê¼Ç×¢ÊÍ
ûÓбäÁ¿,×¢ÊÍÏÔʾ¼òµ¥,ÓÉÃû³Æ±êʶ,ûÓÐÌṩÆäËûÊý¾Ý,(@fweiAnnotation)
µ¥Ò»Öµ×¢ÊÍ
Óë±ê¼Ç×¢ÊÍÀàËÆ,µ«Ìṩһ¶ÎÊý¾Ý,(@fweiAnnotation("value"))
ÍêÕû×¢ÊÍ
Óжà¸öÊý¾Ý³ÉÔ±,ʹÓÃÍêÕûµÄÓï·¨(@feiAnnotation(name1="value1",name2="value2"))
¿ÉÒÔÔÚÐèÒª´«ËͶà¸öֵʱʹÓÃÃû-Öµ¶Ô,
»¹¿ÉÒÔͨ¹ý»¨À¨ºÅΪעÊͱäÁ¿ÌṩֵÊý×é
@fwei2Annotation({
@TODO(name="value",name1="value1"),
@TODO(name="value",name1="value1"),
@TODO(name="value",name1="value1"),
})
˵Ã÷:fwei2Annotation×¢ÊÍÀàÐÍÊÇÒ»¸ö¾ßÓÐÖµµÄ±äÁ¿,Óëµ¥Ò»Öµ×¢ÊÍÀàÐÍÏà·û,Ö»ÊÇÕâÀïµÄµ¥Ò»ÖµÊÇÊý×é
¸ÃÊý×é°üº¬Èý¸öTODO×¢ÊÍ,ÆäÖÐÿ¸ö×¢ÊͶ¼ÊǶàÖµµÄ.¶ººÅ·Ö¸ôÿ¸ö×¢ÊÍÄÚµÄÖµ,ÒÔ¼°µ¥¸öÊý×éÄÚµÄÖµ
Override×¢ÊÍ(±ê¼Ç×¢ÊÍ)(±ê¼Ç×¢ÊÍûÓгÉÔ±±äÁ¿)
½öÓÃÓÚ·½·¨(²»ÓÃÓÚÀà,°üÉùÃ÷»òÆäËû¹¹Ôì)
Ö¸Ã÷×¢Ê͵ķ½·¨½«¸²¸Ç³¬ÀàÖеķ½·¨
Deprecated×¢ÊÍ(±ê¼Ç×¢ÊÍ)
¶Ô²»Ó¦ÔÙʹÓõķ½·¨½øÐÐ×¢ÊÍ
SuppressWarnings×¢ÊÍ
ºöÊÓij²¿·Öwarnings
SuppressWarnings×¢Ê͵ÄvalueÖµ¿ÉÒÔÊǵ¥Öµ»òÊÇÊý×é
@SuppressWarings(value={"unchecked"})
@SuppressWarnings(value={"unchecked", "fallthrough"})
¶¨ÖÆ×¢ÊÍ
TigerÖÐÔö¼ÓÁËÒ»ÖÖеÄÀàÐ
Ïà¹ØÎĵµ£º
public class Test {
public static void main(String args[]) {
System.out.println(Integer.toBinaryString(20)); //Ê®½øÖÆ-->2½øÖÆ
System ......
1. socketͨÐÅ£ºÓпͻ§¶ËºÍ·þÎñ¶ËµÄsocket´úÂë¡£
2.
¶àỊ̈߳º¿Í»§¶ËºÍ·þÎñ¶Ë¸÷ÓÃÒ»Ï̷߳¢ËÍÐÅÏ¢£»·þÎñ¶ËÁíÓÐÒ»¼àÌýỊ̈߳¬ÓÃÓڰѳ¬Ê±µÄÐÅϢɾ³ý¡£
ÕâÀïÓ¦Óõ½ÁËͬ²½£¬Ê¹Á½¸öÏ߳̿ÉÒÔ²Ù×÷ͬһ¸ömap¡£
´úÂ룺£¨ÀàÈ«ÔÚͬһ¸ö°üÄÚ£©
server¶Ë£º
import java.io.BufferedReader;
import java.i ......
Êܵ½“15ÄêÄã»ýÀÛÁËʲô”Ò»ÎĵÄÕ𶯣¬ÌرðÊÕ¼¯¸ÃÎÄѧϰ
Java gc
¹Ø¼ü×Ö: java gc, À¬»ø»ØÊÕ»úÖÆ
1.JVMµÄgc¸ÅÊö
¡¡¡¡gc¼´À¬»øÊÕ¼¯»úÖÆÊÇÖ¸jvmÓÃÓÚÊÍ·ÅÄÇЩ²»ÔÙʹÓõĶÔÏóËùÕ¼ÓõÄÄÚ´æ¡£javaÓïÑÔ²¢²»ÒªÇójvmÓÐgc£¬Ò²Ã»Óй涨gcÈçºÎ¹¤×÷¡£²»¹ý³£ÓõÄjvm¶¼ÓÐgc£¬¶øÇÒ´ó¶àÊýgc¶¼Ê¹ÓÃÀàËƵÄËã·¨¹ÜÀíÄÚ´æºÍÖ´ÐÐÊÕ ......
eval.jar ÐèÒªµ½https://eval.dev.java.net/
ÏÂÔØ
--ÏÂÃæÊÇʾÀýʹÓã¬Ö§³ÖÖÐÎıäÁ¿
Expression exp = new
Expression("(x + y)/2"
);
Map<String, BigDecimal> variables = new
HashMap<String, BigDecimal>();
variables.put("x", new
BigDecimal("4.32"
)); ......
ʹÓÃjavaÖеĶ¯Ì¬´úÀí¿ÉÒÔÍê³ÉºÜ¶àÊÂÇ飬±ÈÈ罫ҵÎñʵÀý½øÐÐÍйܣ¬ÊµÏÖAOPµÈ£¬µ«ÊÇPhpÖÐûÓÐʵÏÖÕâÑùµÄ¶«Î÷£¬×òÌìͻȻÏëµ½Æäʵ¿ÉÒÔͨ¹ýevalÀ´Ä£ÄâÒ»¸ö¶¯Ì¬´úÀí»úÖÆ¡£php±Èjava²»Í¬µÄÊÇ£¬phpÊDz»ÐèÒª±àÒëµÄ£¬Òò´ËÖ»ÒªÎÒÃÇÄܹ»¶¯Ì¬Éú³ÉÒ»¶Î´úÂ룬ȻºóÓÃevalÀ´Ö´ÐоͿÉÒԴﵽЧ¹û¡£´úÂëÈçÏ£º
/**
* ´úÀíʵÏÖÀà
*/
inter ......