

- /*
- * Copyright (c) 2006, 2023, webrx.cn All rights reserved.
- *
- */
- package cn.webrx;
- /**
- *
- *
Powered by webrx On 2023-02-07 17:23:31
- *
- * @author webrx [webrx@126.com]
- * @version 1.0
- * @since 17
- */
- public class Op1 {
- public static void main(String[] args) {
- //++ --
-
-
- double d = 1.56;
- System.out.println(++d);//先++运行,再使用 2.56
- System.out.println(d++);//先使用,再身++ 2.56
- System.out.println(d);//3.56
- int a = 3; //a = 3
- int b = ++a;// b =4 a=4
- System.out.println(b--);//4 b=3
- System.out.println(b);//3
- //程序在些行结束
- //System.exit(0);
- System.out.println("-------------------------------------------");
- //+
- System.out.println(+3);
- System.out.println(3);
- System.out.println(3 + 2);
- System.out.println("hello:" + "李四");
- //输出快捷键 psvm sout
- System.out.println("hello" + 8);
- //-
- System.out.println(2 - 3);
- System.out.println(-3);
- //*
- System.out.println(2 * 3);
- System.out.println("*".repeat(10));
- // / 求整商数 %取余
- System.out.println(5 / 2);//2
- System.out.println(5 % 2);//1
- System.out.println(1.0 * 5 / 2);//2.5
- //3.33
- System.out.printf("%.2f%n", 1.0 * 10 / 3);
- //3.59
- System.out.printf("%.2f%n", 3.586);
- }
- }
-
-
-
- 求整商余数案例
- /*
- * Copyright (c) 2006, 2023, webrx.cn All rights reserved.
- *
- */
- package cn.webrx;
- /**
- *
- *
- * @since 17
- */
- public class Ex01 {
- public static void main(String[] args) {
- int a = 10;
- int b = 2;
- a = Integer.parseInt(args[0]);
- b = Integer.parseInt(args[1]);
- //÷×+-
- if (a % b == 0) {
- System.out.printf("%d ÷ %d = %d%n", a, b, a / b);
- } else {
- System.out.printf("%d ÷ %d = %d ... %d%n", a, b, a / b, a % b);
- }
- }
- }
-
-
