ÈçºÎÔÚJavaÖлñÈ¡µ±Ç°´úÂëÐÐÐкÅ
ΪÁËʵÏÖ×Ô¶¨ÒåµÄlogÀ࣬Äܹ»Êä³ö¾ßÌåµÄ´úÂëÐÐÐкţ¬Í¨¹ýʹÓÃStackTraceElement¶ÔÏóʵÏÖÁË¡£
ÕâÀïÖ¸³öÐèҪעÒâµÄ¼¸¸öÎÊÌ⣺
1. ³ÌÐòÖзµ»ØµÄ´úÂëÐÐÐкţ¬ÊÇн¨StackTrackElement¶ÔÏóµÄÄÇÒ»ÐС£
2. ¿ÉÒÔͨ¹ý´«²ÎµÄ·½·¨ÊµÏÖÊä³öÌØ¶¨ÐÐÐкš£¾ßÌåʵÏÖ¼û´úÂë¡£
1/**
2 *
3 */
4package leo.demo.training;
5
6/**
7 * Get current java file name and current code line number
8 * @author Leo Xie
9 */
10public class CurrentLine {
11 /** *//** http://www.mscto.com
12 * @param args
13 */
14 public static void main(String[] args) {
15 StackTraceElement ste1 = null;
16
17 // get current thread and its related stack trace
18 StackTraceElement[] steArray = Thread.currentThread().getStackTrace();
19 int steArrayLength = steArray.length;
20
21 String s = null;
22
23 // output all related info of the existing stack traces
24 if(steArrayLength==0) {
Èí¼þ¿ª·¢Íø
25 System.err.println("No Stack Trace.");
26 } else {
27 for (int i=0; i<steArrayLength; i++) {
28 System.out.println("Stack Trace-" + i);
29 ste1 = steArray[i];
30 &nbs
Ïà¹ØÎĵµ£º
1¡¢²âÊÔ·½·¨ÈçÏ£º
public static String toUtf8(String str) {
return new String(str.getBytes("UTF-8"),"UTF-8"):
&nb ......
Eclipse²¢²»×Ô´øGUIµÄ¿ÉÊÓ»¯¿ª·¢¹¤¾ß£¬ÄÇôÈç¹ûÒªÔÚEclipse½øÐпÉÊÓ»¯µÄGUI¿ª·¢£¬¾ÍÐèÒªÒÀ¿¿µÚÈý·½µÄ²å¼þ¡£
1. Visual Editor
Eclipse¹Ù·½ÌṩÁËÒ»¸ö½Ð×öVisual Editor(VE)µÄ¿ªÔ´GUI²å¼þ£¬¹¦ÄÜ»¹ÊDZȽÏÇ¿¡£¿ÉÒÔ¸ù¾ÝÓû§µÄ½çÃæGUIÉè¼Æ£¬×Ô¶¯Éú³ÉÏàÓ¦µÄJAVA´úÂ롣ͬÑùÒ²¿ÉÒÔͨ¹ýÏàÓ¦µÄJAVA´úÂë£¬É ......
¿´ÁËÒ»¶Î±±·çÍøµÄÊÓÆµ£¬×ܽἸ¸ö¾µäµÄjavaÏÝÚ司´ó¼Ò¡£
´ð°¸ÔÚ²©¿ÍÖУºhttp://blog.csdn.net/ol_beta/archive/2010/05/17/5598867.aspx
»¶Ó´ó¼ÒÌÖÂÛ£¡
1¡¢ÕÒÆæÊý£º
Java code
public static boolean isOdd(int i){
return i % 2 == 0;
}
ÉÏÃæµÄ·½·¨ÕæµÄÄÜÕÒµ½ËùÓÐµÄÆæÊýô£¿
2¡¢¸¡µãÊýÏë¼õ
Jav ......
ǰ¼¸Ì죬ºþÄÏSEOÔÚÓÃjspдһ¸öÆóÒµÕ¾³ÌÐòµÄʱºò£¬ÒòΪҪ²Î¼ÓÏîÄ¿´ð±ç¾ºÑ¡£¬ËùÒÔ¾ÍÏëΪ×Ô¼ºÐ´µÄ³ÌÐò¸ã¼¸¸öÁÁµã£¬ÒòΪ¸ãSEO¾ÃÁË£¬²»×Ô¾õ¾Í»áÏ뵽α¾²Ì¬£¬µ«ÊÇÔڰٶȲéÁËÒ»¸öÏÂÎ磬ֻ²éµ½ÁËurlrewrite¼Ü°üµÄÏÂÔØµØ·½£¬ºÍ¼ÜÉè·½ÃæµÄÎÄÕ£¬²¢Ã»ÓÐjsp(JAVA)α¾²Ì¬µÄ¾ßÌå²Ù×÷ʾ·¶£¬ÓеÄÒ²Ö»ÊÇ£¬µ¥Ò³ÃæµÄα¾²Ì¬µÄд·¨£¬ÕâÀïÎÒ¾ÍÖØÍ· ......
ÓÐÊÂÇ飬ÓÐЩÊÂÇéÊÇÁ¦²»´ÓÐÄ£¡À´±±¾©ÒѾÁ½¸ö¶àÔ¹ýÈ¥ÁË£¬×Ô¼ºÀë¿ªÖØÇ죬À뿪¿ªËýÁ½¸öÔÂÁË£¬À´Õâ¶ùµÄËùÓзÑÓö¼ÊÇËý¾Êֵģ¬ËýµÄ¸¸Ä¸²»ÖªµÀ£¬Îҵĸ¸Ä¸Ò²²»
ÖªµÀÎÒÏÖÔÚûÓÐÉϰ࣬¸ü²»ÓÃ˵ÎÒ²»ÔÚÉϰàÁË£¡Ã¿½»´òµç»°£¬¶¼¸ø¼ÒÀïÃæµÄÈËÈö»Ñ£¬ÐÄÀïÕæµÄÓÐʱºòÓÐÒ»Öֿ޵ijåµÄ¸Ð¾õ£¬ÐÄÀïÎØÆü£¬È´Ö»ÄÜÊǶÌÔݵ ......