学习Java第四天
-
字符串的想加
-
自增,自减
-
加强转换符的运用
-
操作符的使用
-
Java的运算
-
与或非的判断
-
短路运算
-
代码:public class ping03{
public static void main(String[] args){
char var1=‘A’;
System.out.println(var1+1);
System.out.println(var1);System.out.println(“Happy”+“day”);
System.out.println(“Happy”+“20”);
System.out.println(“Happy”+20);
System.out.println(“Happy20”+50);
System.out.println(“Happy”+(20+50));int num1=10;
System.out.println(num1);
num1++;
System.out.println(num1);
++num1;
System.out.println(num1);int num2=10;
System.out.println(num2);System.out.println(num2++);
System.out.println(num2);
System.out.println(++num2);
System.out.println(num2);
System.out.println(num2);
int num3=10;
int result4=num3–;
System.out.println(num3);
result4=–num3;
System.out.println(result4);
System.out.println(num3);int num4=10;
int num5=20;
int result5=++num4 +num5–;
System.out.println(result5);
System.out.println(num4);
System.out.println(num5);int num6=10;
num6+=10;
System.out.println(num6);num6%=3;
System.out.println(num6);byte num7=10;
num7+=10;System.out.println(10>3);
System.out.println(10<3);int num8=10;
int num9=10;
System.out.println(num8>=num9);
System.out.println(num8<=num9);
System.out.println(num8==num9);System.out.println(3<4 && 10>8);
System.out.println(true && true);
System.out.println(true && false);
System.out.println(false && false);System.out.println(true || true);
System.out.println(false || false);
System.out.println(false || true);System.out.println(!true);
System.out.println(!false);int num10=10;
System.out.println(3<4 && num10>10);
System.out.println(3<4 && num10>=10);
System.out.println(3<4 && num10++>10);
System.out.println(3<4 && ++num10>10);
System.out.println(num10);num10=10;
System.out.println(3>4 && num10>10);
System.out.println(3>4 && num10>=10);
System.out.println(3>4 && num10++>10);
System.out.println(3>4 && ++num10>10);
System.out.println(num10);int num11=10;
System.out.println(3<4 || num11>10);
System.out.println(3<4 || num11>=10);
System.out.println(3<4 || num11++>10);
System.out.println(3<4 || ++num11>10);
System.out.println(num11);num11=10;
System.out.println(3>4 || num11>10);
System.out.println(3>4 || num11>=10);
System.out.println(3>4 || num11++>10);
System.out.println(3>4 || ++num11>10);
System.out.println(num11);int num12=10;
int num13=20;int max=num12>num13?num12:num13;
System.out.println(max);int min=num12>num13?num13:num12;
System.out.println(min);long num14=2020080605050L;
System.out.println(num14);
}
运算符:加法运算符,数值加字符
自增和自减有两种情况:1单独使用。2与打印一起连着使用。
无论是大于,小于,大于等于,小于等于,不等于,都属于运算符
判断与或非
与:&&,必须俩个条件同时成立最终结果成立
或:||,有一个成立则结果成立
非:!,如果有一个结果成立,那最终结果成立。