JAVA¹æÔò »ù´¡Æª
±¾ÎĽéÉܵÄJAVA¹æÔòµÄ˵Ã÷·ÖΪ5¸ö¼¶±ð£¬¼¶±ð1ÊÇ×î»ù±¾Ò²ÊÇ×îÖØÒªµÄ¼¶±ð£¬ÔÚ½ñºó½«Â½Ðøд³öÆäËûµÄ¹æÔò¡£×ñÊØÁËÕâЩ¹æÔò¿ÉÒÔÌá¸ß³ÌÐòµÄЧÂÊ¡¢Ê¹´úÂëÓиüºÃµÄ¿É¶ÁÐԵȡ£
£¨1£© ±ÜÃâʹÓÃNEW¹Ø¼ü×ÖÀ´´´½¨String¶ÔÏó¡£
°ÑÒ»¸öString³£Á¿copyµ½String ¶ÔÏóÖÐͨ³£ÊǶàÓà¡¢ÀË·Ñʱ¼äµÄ
Public class test{
Public void method(){
System.out.print (str);
}
private String str = new String ("1"); //ÕâÀïн¨¶ÔÏóÊÇÍêȫûÓбØÒªµÄ
private String str2=”2” //ÕýÈ·µÄÓ¦¸ÃÈç´Ë
}
²Î¿¼£ºJoshua Bloch: "Effective Java - Programming Language Guide"
£¨2£© ±ÜÃâʹÓò»±ØÒªµÄǶÌס£
¹ý¶àµÄǶÌ×»áʹÄãµÄ´úÂ븴ÔÓ»¯£¬¼õÈõ¿É¶ÁÐÔ¡£
Public class test {
String add (){
Int c=(a=a+b)+b; //¹ýÓÚ¸´ÔÓ
Return c
}
}
²Î¿¼£ºhttp://java.sun.com/docs/codeconv/html/CodeConventions.doc9.html#177
£¨3£© ±ÜÃâÔÚͬһÐÐÉùÃ÷²»Í¬ÀàÐ͵Ķà¸ö±äÁ¿
ÕâÑù¿ÉÒÔʹ³ÌÐò¸ü¼ÓÇåÎú£¬±ÜÃâ»ìÂÒ
private int index, index1[];
ÕýÈ·µÄÓ¦¸ÃÈç´Ë£º
private int index;
private int index1[];
²Î¿¼£ºhttp://java.sun.com/docs/codeconv/html/CodeConventions.doc5.html#2992
(4) ÔÚÿһÐÐÀïдһÌõÓï¾ä
ÕâÌõ¹æÔò²»°üÀ¨forÓï¾ä£º±ÈÈ磺'for (int i = 0; i < 10; i++) x--;’¿ÉÒÔÔö¼Ó´úÂëµÄ¿É¶ÁÐÔ¡£
public class OSPL {
int method (int a, int b) {
int i = a + b; return i; // ¿É¶ÁÐÔ²»Ç¿
}
ÕýÈ·µÄ£º
public class OSPLFixed {
int method (int a, int b) {
int i = a + b;
return i;
}
}
²Î¿¼£ºSection 7.1 of http://java.sun.com/docs/codeconv/html/CodeConventions.doc6.html#431
£¨5£©¾³£´Ófinalize ()Öе÷ÓÃsuper.finalize ()
ÕâÀïµÄfinalize ()ÊÇjavaÔÚ½øÐÐÀ¬»øÊÕ¼¯µÄʱºòµ÷Óõģ¬ºÍfinally²»Ò»Ñù¡£Èç¹ûÄãµÄ¸¸ÀàûÓж¨Òåfinally£¨£©µÄ»°£¬ÄãÒ²Ó¦¸Ãµ÷Óá£ÕâÀïÓÐÁ½¸öÔÒò£º£¨1£
Ïà¹ØÎĵµ£º
package homework01;
public class TestWhile {
public static double factorial(int n) //Çó½×³Ëº¯Êý
{
if(n==0) return 1;
else return n* factorial(n-1);
}
public static void main(String[] args) {
System.out.println(factorial(170));//test:ÄÜ´òÓ¡³öÀ´£ ......
public class OuterClass
{
public class InnerClass
{
public int code = 100;
}
public static void main(String[] args)
{
OuterClass outer = new OuterClass();
OuterClass.InnerClass o = outer.new InnerClass();
System. ......
Àà¼ÓÔØÆ÷ÊÇ Java ÓïÑÔµÄÒ»¸ö´´Ð£¬Ò²ÊÇ Java ÓïÑÔÁ÷ÐеÄÖØÒªÔÒòÖ®Ò»¡£ËüʹµÃ Java Àà¿ÉÒÔ±»¶¯Ì¬¼ÓÔص½ Java ÐéÄâ»úÖв¢Ö´ÐС£Àà¼ÓÔØÆ÷´Ó JDK 1.0 ¾Í³öÏÖÁË£¬×î³õÊÇΪÁËÂú×ã Java Applet µÄÐèÒª¶ø¿ª·¢³öÀ´µÄ¡£Java Applet ÐèÒª´ÓÔ¶³ÌÏÂÔØ Java ÀàÎļþµ½ä¯ÀÀÆ÷Öв¢Ö´ÐС£ÏÖÔÚÀà¼ÓÔØÆ÷ÔÚ Web ÈÝÆ÷ºÍ OSGi Öеõ½Á˹㷺µÄʹÓá ......
Ò».´úÂëÓÅ»¯
¡¡¡¡ÄÚ´æ»áÒç³ö¿Ï¶¨ºÍ´úÂëÌÓ²»Á˹Øϵ,99.99%ѧjavaµÄÈ˶¼ÖªµÀÀ¬»ø»ØÊÕÆ÷ÊÇ javaµÄÒ»´óÓŵ㲢¾Ý´ËÀ´³°Ð¦C++¡£ÏÔÈ»Õâ¸öÌØÐÔΪ´úÂë±àдÕßÊ¡Á˲»ÉÙÊ£¬µ«Õâ¸öÌØÐÔÈ´´øÀ´Á˲»ÉÙÒþ»¼¡£¾Ù¸öÀý×ÓÔÚÓÎÏ·µ±Öо³£Óв»Í¬³¡¾°µÄÇл»£¬Èç´ÓÓÎÏ·Âß¼Í˵½Ö÷²Ëµ¥Âß¼,¶ÔÓÎÏ·Âß¼¶ÔÏóµÄ̬¶ ......
ÏÂÔصØÖ· ¿ÉÒÔÔÚeclpseÖÐÅܵÄ
Éú²úexcelÓ¦Óãº
package com.lihp.exl;
/**
Ä¿µÄ£ºÌṩÓÉÊý¾Ý¶ÔÏ󼯺ÏÀࣨVector£©Éú³ÉExcel¹¤×÷±íµÄ¹¦ÄÜ
×÷Õߣºlihaipeng
*/
import java.io.*;
import java.util.*;
import java.lang.reflect.Method;
import org.apache.poi.hssf.usermodel.HSSFSheet;
impor ......