摘要:
该漏的漏,该藏的藏 我们设计程序要追求"高内聚,低耦合"。高内聚就是类的内部数据操作细节自己完成,不允许外部干涉;低耦合:仅暴露少量的方法给外部使用。 封装(数据的隐藏) 通常,应禁止直接访问一个对象数据的实际表示,而应通过操作接口来访问,这称为信息隐藏。 记住这句话就够了:属性私有,get/set 阅读全文
posted @ 2021-06-28 17:25
橙子yuan
阅读(46)
评论(0)
推荐(0)
摘要:
breack contunue for循环 //(1)只能在循环体内和switch语句体内使用break; //(2)当break出现在循环体中的switch语句体内时,起作用只是跳出该switch语句体,并不能终止循环体的执行。若想强行终止循环体的执行,可以在循环体中,但并不在switch语句中设 阅读全文
posted @ 2021-06-28 16:44
橙子yuan
阅读(81)
评论(0)
推荐(0)
摘要:
public class Demo01 { public static void main(String[] args) { double sum = add(1.1, 2.2); Demo01 Demo01 = new Demo01(); Demo01.test(1,1,1,1,1); } //方 阅读全文
posted @ 2021-06-28 16:25
橙子yuan
阅读(31)
评论(0)
推荐(0)
摘要:
初始化 // 静态初始化: 创建+赋值 不能改变 int[] a = {1, 2, 3, 4, 5}; // forEach for (int array : a) { System.out.println(array); } // 动态初始化,分配空间为10 int[] num = new int 阅读全文
posted @ 2021-06-28 16:24
橙子yuan
阅读(28)
评论(0)
推荐(0)
摘要:
整数类型 byte short int long byte num1 = 10; short num2 = 10; int num3 = 10; long num4 = 10L; // 结尾有标识L 浮点类型 float double float num5 = 10.22323F; // 结尾有标识 阅读全文
posted @ 2021-06-28 16:13
橙子yuan
阅读(69)
评论(0)
推荐(0)
摘要:
package com.oop.demo01; // 构造器 public class Person01 { // 一个类即使什么都不写,它也会存在一个方法 alt + insert // 显示的定义构造器 String name; // 默认构造器,无参数 public Person01() { 阅读全文
posted @ 2021-06-28 15:46
橙子yuan
阅读(35)
评论(0)
推荐(0)

浙公网安备 33010602011771号