请你解释下面的行为.
public class EqAndRef {
public static void main(String[] args) {
Integer i = 10;
Integer j = 10;
Double a = 10D;
Double b = 10D;
System.out.println(i.equals(j));
System.out.println(i == j);
System.out.println(a.equals(b));
System.out.println(a == b);
}
}
Run Code Online (Sandbox Code Playgroud)
输出jdk 6
true
true
true
false
Run Code Online (Sandbox Code Playgroud)
为什么a == b是假的而我= = j不是假的?
我会问一个小问题,我可能没有清楚地遵守代码.我们是否需要在这里做更多的事情.对于弹簧注射,我得到以下异常...它对于构造函数arg工作正常但不是简单的原理....
can you point mistake here that I am committing...
Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'triangleType' of bean class [com.raj.spring.core.Triangle]: Bean property 'triangleType' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
classes ...
package com.raj.spring.core;
public class Triangle {
private String triangleType;
public Triangle(String triangleType){
this.triangleType = triangleType;
}
public Triangle(){
System.out.println("constructor");
}
public void drawShape() {
System.out.println(getTriangleType()+" Shape drawn.");
}
/**
* @return the …Run Code Online (Sandbox Code Playgroud)