摘要:
package constructor;public class Flower { int petalCount = 0; String s = new String("null"); Flower(int petals) { petalCount = petals; System.out.println("Constructor int only, petalCount: " + petalCount); } Flower(String ss){ s = ss; System.out.println("Constructor String o 阅读全文
摘要:
package BigDecimal;import java.math.BigDecimal;import java.lang.Object;public class BigDecimalTest { public static void add(double i, double j){ System.out.println(i+j);//2.5999999999999996 BigDecimal bi = new BigDecimal(1.2); BigDecimal bj = new BigDecimal(1.4); System.out.println(bj);//1.3... 阅读全文
摘要:
java 中没有引用传递,都是值传递的,可以通过传递副本修改对象的,副本交换,并不影响原引用package Object.reference;public class People { private String name; private int age; public People(){ } public People(String name, int age) { super(); this.name = name; this.age = age; } public String toString(){ return "name:" + name + " 阅读全文