Java中的值传递和地址传递
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class TestClass {
/**
* @param args
*/
public static void main(String[] args) {
// TODO 自動生成されたメソッド?スタブ
List li = searchCrdNo();
System.out.print("main method now is :"+((Map) li.get(0)).get("AA"));
}
public static List searchCrdNo() {
List li = new ArrayList();
Map ma = new HashMap();
ma.put("AA", "1");
li.add(ma);
Map crdNoMap = (Map) li.get(0);
crdNoMap.put("AA", "22");
System.out.print("now is :"+((Map) li.get(0)).get("AA"));
return li;
}
}
now is :22main method now is :22
最简单的例子,按值传递的例子!
相关文档:
Caused by: java.sql.SQLException: ORA-00918: column ambiguously defined
Caused by: com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in com/ibatis/jpetstore/persistence/sqlmapdao/sql/Item.xml.
--- The error occurred while applying a parameter map.&nbs ......
我们经常会用System.currentTimeMillis()在事件开始前和结束后设置一个开始时间和结束时间,用他们的差作为程序执行的时间。
我们不妨定义一个接口用java回调来实现动态计算。
接口定义:
package com.hd123.h5.ejb.verctrl;
public interface CallBack {
public void callBack();
}
然后是实现这个接口
pac ......
1. 首先String不属于8种基本数据类型,String是一个对象。
因为对象的默认值是null,所以String的默认值也是null;但它又是一种特殊的对象,有其它对象没有的一些特性。
2. new String()和new String(“”)都是申明一个新的空字符串,是空串不是null;
3. String str=”kvill”;
......
隐藏窗体内的鼠标指针,直接上代码
import java.awt.Image;
import java.awt.Point;
import java.awt.Toolkit;
import java.awt.image.MemoryImageSource;
import javax.swing.JFrame;
public class HideCursor extends JFrame {
HideCursor() {
this.setBounds(300, 300, 300, 300);
&nb ......
public class Sort {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int[] arry = { 19, 10, 5, 45, 100, 30, 35, 29 };
int[] sortArry = mergeSort(arry);
for (int i = 0; i < sortArry.le ......