在java中不同优先级会产生有不同结果:
public class test {
public static void main(String[] args) {
System.out.println(1);
System.out.println( 1+2+"=1+2");
System.out.println(2);
System.out.println( "1+2="+1+2);
System.out.println( 1+2+"=1+2");
System.out.println(2);
System.out.println( "1+2="+1+2);
System.out.println(3);
System.out.println( "1+2="+(1+2));
}
}
System.out.println( "1+2="+(1+2));
}
}
结果: