java循环技巧
<!--
/* Font Definitions */
@font-face
{font-family:宋体;
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-alt:SimSun;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
@font-face
{font-family:"\@宋体";
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-parent:"";
margin:0cm;
margin-bottom:.0001pt;
text-align:justify;
text-justify:inter-ideograph;
mso-pagination:none;
font-size:10.5pt;
mso-bidi-font-size:12.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:宋体;
mso-font-kerning:1.0pt;}
h1
{mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
mso-pagination:widow-orphan;
mso-outline-level:1;
font-size:24.0pt;
font-family:宋体;
mso-bidi-font-family:宋体;
font-weight:bold;}
p
{mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:宋体;
mso-bidi-font-family:宋体;}
/* Page Definitions */
@page
{mso-page-border-surround-header:no;
mso-page-border-surround-footer:no;}
@page Section1
{size:595.3pt 841.9pt;
margin:72.0pt 90.0pt 72.0pt 90.0pt;
mso-header-margin:42.55pt;
mso-footer-margin:49.6pt;
mso-paper-source:0;
layout-grid:15.6pt;}
div.Section1
{page:Section1;}
-->
java
循环技巧
在Java
程序中可能使用多层循环来处理复杂的逻辑。但如果要从最内层循环跳出最外层循环是比较麻烦。下面的代码是一个三层循环的例子:
String[]arr=newString[]{"a","b","c"};
for(Strings:arr)
{
for(Stringss:arr)
{
for(Stringsss:
相关文档:
反射机制
特点:动态获取类以及类中成员。
通常在程序扩展时,会使用父类或者接口完成,其实就是多态。
在这种情况,运行时,还是需要给其传递一个自定义的子类对象。需要自己new来完成。
虽然修改动作已经很少了,但还是需要修改部分细节。
interface Inter{void show();}
class Demo{
  ......
学了集合类,想用Java的集合类编一个通讯录,可是发现题目要对通讯录中的姓名和编号进行排序。
菜鸟刚刚学Java,本来还真不知道有比较器,嘿嘿,以为Java是如此强大,可以直接调用Sort()方法就可以对集合类中的对象进行排序,嘿嘿,于是便试了一下,太不好使了呀,嘿嘿,于是我看了看书,到网上查了查,原来要实现比较器的 ......
<!--
/* Font Definitions */
@font-face
{font-family:宋体;
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-alt:SimSun;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
@font-face
{font-family:"\@宋体" ......