- 博客(19)
- 收藏
- 关注
转载 系统之间的数据对接和传输
定义接口,其实就是定义缸上的出水口。口的大小、滤网、放水的频率等…就是个规则。这个规则约定了哪些数据是需要流过去,以及流过去的条件(像门禁密码一样)。定义接口就是设定口令、数据范围、推送前的筛选、转化运算规则等,这是接口的核心内容。
2023-06-14 16:34:44
5684
原创 【进阶】2.1对象的识别,2.2对象的交互,2.3封闭的访问属性,2.4开放的访问属性,2.5包,2.6类变量,2.7类函数
2.1对象的识别package clock;public class Display { private int value = 0;//private代表该定义的变量只能在内部调用 private int limit = 0; public Display(int limit) { this.limit = limit; } public void increase() { value++; if(limit == value) { value = 0;
2022-04-29 09:42:15
243
原创 【进阶】1.1用类制造对象,1.2定义类(自动售货机),1.3成员变量与成员函数,1.4对象初始化
1.1用类制造对象package shapes;public class MyPic { public static void main(String[] args) { Picture pic = new Picture(520,400);//用picture这个类创建了一个名为pic的对象 Circle c1 = new Circle(320,40,80);//用circle这个类创建了一个名为c1的对象 Rectangle r1 = new Rectangle(100, 10
2022-04-25 18:54:32
389
原创 7.1函数的定义(m和n之间的素数),7.2函数参数,7.3函数调用,7.4函数内的变量—本地变量
7.1函数的定义目标:求m和n之间的素数--------------------------------------------------------package Main;import java.util.Scanner;public class Main { public static boolean isPrime (int i)//判断素数,定义了名为isPrime 的函数 { boolean isPrime = true; for(int k=2;k<i;k++
2022-04-21 15:52:59
165
原创 6.1字符类型,6.2逃逸字符,6.3包裹类型,6.4字符串变量,6.5字符串操作,6.6Math
6.1字符类型6.2逃逸字符 回退一格结果:6.3包裹类型可以将包裹类型当做普通的基础类型使用: int i = 10; integer k = 10; k = i;6.4字符串变量package Main;import java.util.Scanner;public class Main { public static void main(String[] args) { Scanner in = new Scanner(System
2022-04-20 18:41:34
160
原创 5.1初识数组,5.2创建数组,5.3数组的元素,5.4数组变量, 5.5投票统计,5.6遍历数组(for--each),5.7素数,5.8二维数组
5.1初识数组目标:输入一串数字,计算其平均数,输出大于平均数的数字public static void main(String[] args) { Scanner in = new Scanner(System.in); int x=0; int cnt=0; double sum = 0; int[] number = new int[100];//定义数组 x = in.nextInt(); while( x!= -1) { number[cnt] = x; sum =
2022-04-18 12:55:04
170
原创 4.1 for循环,4.2复合赋值,4.3控制循环(素数),4.4多重循环(100以内的素数),4.5逻辑类型,4.6求和(1/n),4.7求最大公约数
4.1for循环阶乘计算,n!public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int i=1; int factor = 1; for( i=1 ; i<=n ; i=i+1 ) { factor = factor*i; } System.out.println(factor);}4.2复合赋值4.3控制循环素数:只
2022-04-13 12:34:26
485
原创 3.1循环体(while),3.2数数字(while),3.4 do-while循环, 3.5计数循环, 3.6计算平均数,3.7猜数,3.8整数分解
3.1循环(while)public static void main(String[] args) { //初始化 Scanner in = new Scanner(System.in); int balance = 0; while(true) //不停歇的循环此售票过程 { System.out.print("请投币:"); int amount=in.nextInt(); balance = balance + amount; if( balance >=
2022-04-07 17:03:43
151
原创 2.5级联和嵌套的判断语句(三数比较),2.6多路分支(Switch-case)
1,三数比较public static void main(String[] args) { Scanner in = new Scanner(System.in); int x; int y; int z; System.out.print("请输入三个数:"); x = in.nextInt(); y = in.nextInt(); z = in.nextInt(); int max = 0; if( x > y) { if(x>z) max=x; e
2022-04-06 21:34:18
167
原创 2.3比较,2.4判断语句
2.3比较public static void main(String[] args) { //初始化 Scanner in = new Scanner(System.in); //读入投币金额 System.out.print("请投币:"); int amount=in.nextInt(); if( amount >= 10) { //打印车票 System.out.println("************"); System.out.println("*城际铁路专
2022-04-06 20:30:27
444
原创 2.2关系运算、运算优先级
1,运算优先级2,关系运算3,整数和浮点数之间可以比较(5 == 5.0 is true)。浮点数和浮点数之间不可以比较(1.0 == 0.5+0.5 is false)。两个浮点数之间看其差值的绝对值是否小于10的负六次方。...
2022-04-06 20:01:43
374
原创 2.1比较(自动售票机)
package hello;import java.util.Scanner;public class hello {public static void main(String[] args) { //初始化 Scanner in = new Scanner(System.in); //读入投币金额 System.out.println("请投币:"); int amount=in.nextInt(); //判断 System.out.println(amount); Syst
2022-04-06 19:51:46
361
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人