Java SE series:2. enhance your java basis! [doc chm: jdk6api Chinese reference]

时间:2023-01-20 14:48:00

1. javaee(Web) and Android

2. how to use eclipse and break point debuging in eclipse, as to java web, use myeclipse:

  shortcut keys:  Java SE series:2. enhance your java basis! [doc chm: jdk6api Chinese reference],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:  Java SE series:2. enhance your java basis! [doc chm: jdk6api Chinese reference]

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]

Java SE series:2. enhance your java basis! [doc chm: jdk6api Chinese reference]的更多相关文章

  1. Java SE series:1. environment configure and Hello world! [We use compiler and packager to create an application!]

    1. cli (command line interface) and gui (graphic user interface) use javahome path, search classpath ...

  2. java1234教程系列笔记 S1 Java SE chapter 02 lesson 03 java基本数据类型

    第二章 第三节 数据类型 3.1 分类 基本数据类型.引用类型 3.2整型 byte 8 short 16 int  32 long 64 作业: A:1-10求和 B:float double 的最 ...

  3. Monitor and diagnose performance in Java SE 6--转载

    Java SE 6 provides an in-depth focus on performance, offering expanded tools for managing and monito ...

  4. Java SE 6 新特性: Java DB 和 JDBC 4.0

    http://www.ibm.com/developerworks/cn/java/j-lo-jse65/index.html 长久以来,由于大量(甚至几乎所有)的 Java 应用都依赖于数据库,如何 ...

  5. Java SE 6 新特性: 对脚本语言的支持

    2006 年底,Sun 公司发布了 Java Standard Edition 6(Java SE 6)的最终正式版,代号 Mustang(野马).跟 Tiger(Java SE 5)相比,Musta ...

  6. 学习java随笔第一篇:搭建java平台(java se)

    电脑系统:windows8 在这里介绍一下java平台的3个版本: Java SE--Java Standard Edition,Java的标准版,主要用于桌面级的应用和数据库开发. Java EE- ...

  7. 在 Java SE 6 中监视和诊断性能问题

    Java™ Platform, Standard Edition 6 (Java SE) 专注于提升性能,提供的增强工具可以管理和监视应用程序以及诊断常见的问题.本文将介绍 Java SE 平台中监视 ...

  8. Java SE/EE/ME概念理解(Java版本发展历史)

    继上一篇文章http://www.cnblogs.com/EasonJim/p/6181981.html中说的区别,其实分析的不够彻底,因此再次在这里做详细的分析. 零.Java与Sun.Oracle ...

  9. 数据结构与算法(3)- C++ STL与java se中的vector

    声明:虽然本系列博客与具体的编程语言无关.但是本文作者对c++相对比较熟悉,其次是java,所以难免会有视角上的偏差.举例也大多是和这两门语言相关. 上一篇博客概念性的介绍了vector,我们有了大致 ...

随机推荐

  1. 抱歉!15:44-16:39阿里云RDS故障造成全站不能正常访问

    非常非常抱歉!2016年3月7日15:44-16:39,由于阿里云RDS(云数据库)故障,造成全站不能正常访问,给您带来了很大很大的麻烦,恳请您的谅解! 故障是在15:44开始出现的,应用日志中出现大 ...

  2. Android线程之主线程向子线程发送消息

    和大家一起探讨Android线程已经有些日子了,谈的最多的就是如何把子线程中的数据发送给主线程进行处理,进行UI界面的更新,为什么要这样,请查阅之前的随笔.本篇我们就来讨论一下关于主线程向子线程如何发 ...

  3. 【wikioi】1904 最小路径覆盖问题(最大流+坑人的题+最小路径覆盖)

    http://wikioi.com/problem/1904/ 这题没看数据的话是一个大坑(我已报告官方修复了),答案只要求数量,不用打印路径...orz 最小路径覆盖=n-最大匹配,这个我在说二分图 ...

  4. [hackerrank]The Love-Letter Mystery

    https://www.hackerrank.com/contests/w3/challenges/the-love-letter-mystery 简单题. #include <cstdlib& ...

  5. Linux 锁

    问题: 1.假如对某个文件加了锁/lock,但是程序退出时没有关闭锁,如果想在另外一个程序中用这个文件,如何办? 2.

  6. checkbox插件

    1.全选或者全不选 首先判断全选或全不选checkbox是否被选中. 如果被选中,则为每个选项checkbox设置obj.checked='checked'; 如果未被选中,则为每个选项checkbo ...

  7. &lbrack;swoole&rsqb;swoole常见问题总汇

    1.在daemon模式下Task异步任务写入文件需要采用绝对路径: 1.Task异步任务中操作数据库,如果仅仅只是在启动程序之初进行一次数据库链接,链接会在一定的时间后自动断开,应对这样的情况的最好办 ...

  8. XiaoKL学Python(E)Generator Expressions

    在 阅读 https://github.com/vitonzhang/objc_dep 中的 objc_dep.py 时遇到: objc_files = (f for f in files if f. ...

  9. CGBitmapContextCreate函数参数详解 以及在 ios7下变化

    函数原型: CGContextRef CGBitmapContextCreate ( void *data,    size_t width,    size_t height,    size_t ...

  10. cgroup限制内存

    cgroup有个memory子系统,有两组对应的文件,一组带 memsw ,另一组不带. # docker ps -a # cd /sys/fs/cgroup/memory/docker/4b5619 ...