运算符(重要:++、--)

发布时间:2026/5/27 22:03:42

运算符(重要:++、--) public class 运算符 { /* 算术运算符 — * / % -- 赋值运算符 关系运算符 ! instanceof 返回结果为boolean值 逻辑运算符: || ! * */ public static void main(String[] args) { int a10; int b20; int c25; int d30; System.out.println(a/(double)b);//主要作用范围 0.5 System.out.println(c%a);//取余模运算 5 long e123456789L; int f123; System.out.println(ef);//有long就是long类型没有long就是int类型 System.out.println(); // -- int g3; int hg;// g gg1 执行完这行代码后先给h赋值在自增 System.out.println(h); //3 System.out.println(g); //4 int ig;// g gg1 执行完这行代码前先自增再给h赋值 System.out.println(g);//5 System.out.println(h);//3 System.out.println(i);//5 System.out.println(); //幂运算 2^3 2*2*28 //很多运算我们会使用一些工具类来操作 double powMath.pow(2,3); System.out.println(pow); } }

相关新闻