1. javaee(Web) and Android
2. how to use eclipse and break point debuging in eclipse, as to java web, use myeclipse:
shortcut keys: ,do not use Chinese or space in workspace path, configure JRE default, as jdk already has jre, we just configure with jdk path! but if we have a project from others, we better use myeclipse default, coz on different machines, JRE path varies.
3. create a new class, need to specify package name, super class use default, check static void main method stub and inherited abstract method when first entry.
4. right click project and select properties, then configure project properties, check java compiler and compile, so, be aware, your compiler version and your jre version should at least be the same, if we meet with version problems, we should configure project java build path, remove old default libries and add JRE system library into build_path, in this way, our compiler and jre environment can be configured the same. But the higher version will comply with lower.
the same with vs project .net framework target version.
eg: import java.io.file, we can use copy(src,dest), FileNotFoundException,FileInputStream,FileOutputStream,existFile(src), inputstream.read(buffer)>0 and io exceptions, right click project and click debug as java application to debug. F5 to step into the method, F6 to step out like F11, F7 to step out a method like F10 in vs. remember to stop JVM and clear all breakpoints after debugging, we can watch the args while debugging.
F5: step into, F6: step over,F7: step return,drop to frame,resume
5. Ho to configure eclipse shotcut keys: window->preference, select keys under General to configure the shortcut keys and apply. use alt+/ for hints!, repeatly press ctrl+1 to repaidly restore errors. ctrl+shift+o to automatically import package. ctrl+ship+f to auto layout it, ctrl+leftclick to navigate to source, goto java path and import src.zip using file pattern, use alt+left arrow and right arrow to navigate when navigating src,ctrl+shift+/ to comment and ctrl+shift+\ to uncomment,F2 to see method description, window-> reset perspective to reset window layout same with VS.
const value should be upper case, ctrl+shift+x/y to change upper case and lower case. ctrl+alt+ down arrow to copy current line. alt+up/down arrow to toggle current and next line order, watching class hierarchy, press ctrl+t, press ctrl+shift+t to directly see the code source!
ctrl+shift+L to see all shortcut in eclipse.c
6. junit test framework: create a test class for your src code, to use junit, just add @Test as annotation, press ctrl+1 to see hints! right click the method or the whole class, then select run as jUnit Test, see result from jUnit window. use @Before and @After when running test method to add as interceptor,@BeforeClass and @AfterClass as interceptor of the whole class[class interceptor is not so often used]. we can now use Assert. in jUnit now.
7. About java 5 enhancements:
import static: eg: import static java.lang.system.out; import static java.lang.Math.*; same with vs using =, but ctrl+1 is definitely faster.
wrap and unwrap boxing; eg: Integer i=1/(new Integer(1));(jdk 5+); int j=i;
typical usage: new ArrayList().add(1/(old way in jdk 1.4) new Integer(1)), really useful. list.iterator, it.hasNext(); int k=(Integer) it.next();
8. enhanced for loop: eg int arr[] =(1,2,3); for(int num: arr){} Map map=new HashMap(); map.put("1","aaa");Set set=map.keySet(); Iterator it=set.iterator(); while(it.hasNext()){String key=(String)it.next(); String value=(String)map.get(key); } HashMap is not sequencial! remember, when it is stored, the order is different from your storage order! if we want the order, just use LinkedHashMap() when you need order!!! or we can use map.entrySet() to get keyvalue collections, then iterate it to get the entry(Map.Entry as key value pair) then value of the entry. we can use for like (for..in) to iterate set! this for loop only suits reading data. but pay attention to reference type like String. ArrayList.get(0), it defines an argument to iterate. never change set data! if we want to modify data in a list, we should use traditional ways, i.e. using for(int i=0;...)
9. [07]