字符+数值
运算符Java语言的运算符和其他高级语言的运算符基本相同。按运算符需要的操作数来分,有一元运算符(如++、- -等),二元运算符(如+、-、等)和三元运算符(如? : )。按照运算符的类别来分,则分为以下几类:
1、算术运算符(+,-, ,/,%,++,–);
2、关系运算符(>,<,>=, <=,,!= );
3、逻辑运算符(&&,||,!);
4、位运算符(>>,<<,>>>,&,^,|,~);
5、赋值运算符(=,+=,-=,*=,/=);
6、条件运算符(,?;
7、其他运算符。
运行代码:
public class Abc{
public static void main(String[] args){
System.out.println();
char var1=‘A’;
System.out.println(var1+1);
System.out.println(var1);
System.out.println("=");
System.out.println(“asd”+“1”);
System.out.println(“asd”+“20”);
System.out.println(“asd33”+44);
System.out.println(“asd”+(11+22));
System.out.println("=");
int num1=10;
System.out.println(num1);
num1++;
System.out.println(num1);
++num1;
System.out.println(num1);
System.out.println("");
int num2=10;
System.out.println(num2);
System.out.println(num2++);
System.out.println(++num2);
System.out.println(num2);
System.out.println("=");
int num3=10;
int qwe1=num3–;
System.out.println(qwe1);
System.out.println(num3);
qwe1=–num3;
System.out.println(qwe1);
System.out.println(num3);
System.out.println("");
int num4=10;
int num5=20;
int qwe2=++num4 + num5–;
System.out.println(qwe2);
System.out.println(num4);
System.out.println(num5);
System.out.println("");
int num6=10;
num6+=10;
System.out.println(num6);
num6%=4;
System.out.println(num6);
byte num7=10;
num7+=10;
System.out.println(num7);
System.out.println("=");
System.out.println(10>5);
System.out.println(10<5);
int num8=10;
int num9=20;
System.out.println(num8>=num9);
System.out.println(num8<=num9);
System.out.println(num8num9);
System.out.println("======");
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);
System.out.println("============");
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(num10);
System.out.println(3<4 && num10++>10);
System.out.println("==============");
num10=10;
System.out.println(3>4 && num10>10);
System.out.println(num10);
System.out.println(3>4 && num10>=10);
System.out.println(3>4 && num10++>10);
System.out.println(num10);
System.out.println(3>4 && ++num10>10);
System.out.println(num10);
System.out.println("=============");
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(num11);
System.out.println(3<4 || num11++>10);
System.out.println("==============");
num11=10;
System.out.println(3>4 || num11>10);
System.out.println(num11);
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(num11);
System.out.println("==============");
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);
System.out.println("2020080605035");
}
}
运行结果: