assignops.java

来自「Java 入门书的源码」· Java 代码 · 共 20 行

JAVA
20
字号
//Copyright (c) 1998, Arthur Gittleman
//This example is provided WITHOUT ANY WARRANTY either expressed or implied.

/*  Uses the operators which combine arithmetic and assignment */
 
         public class AssignOps {
               public static void main(String [ ] args) {
                   int  a=2, b=4, x=3, y=5, z=6, w=14;     
                   y -= 7;
                   System.out.println("y = " + y);
                   a *= x;
                   System.out.println("a = " + a); 
                   x /= y;
                   System.out.println("x = " + x);            
                   w %= z;
                   System.out.println("w = " + w);
                   b *= z + 3;   
                   System.out.println("b = " + b);                       }
           } 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?