oo.day02

Shoot射击游戏第一天:
1.创建了6个对象类,并创建World类测试

Shoot射击游戏第二天:
1.给6个对象类添加构造方法,并测试


回顾:
1.什么是类?什么是对象?
2.如何创建类?如何创建对象?如何访问成员?


笔记:
0.方法的签名:方法名+参数列表
1.方法的重载(Overload):
  1)发生在一个类中,方法名称相同,参数列表不同,方法体不同
  2)编译器在编译时根据方法的签名自动绑定调用的方法
2.构造方法:构造函数/构造器/构建器
  1)给成员变量赋初值
  2)与类同名,没有返回值类型
  3)在创建(new)对象时被自动调用
  4)若自己不写构造方法,则编译器默认一个无参构造方法
    若自己写了构造方法,则编译器不再默认提供
  5)构造方法可以重载
3.this:指代当前对象,哪个对象调用方法它指的就是哪个对象
       只能用在方法中,方法中访问成员变量之前默认有个this.
  this的用法:
    1)this.成员变量名---------访问成员变量
    2)this.方法名()-----------调用方法(一般不用)
    3)this()------------------调用构造方法
4.null:空,没有指向任何对象
       若引用的值为null,则该引用不能再进行任何操作了,
       若操作则发生NullPointerException空指针异常
5.引用类型变量画等号:
  1)指向同一个对象
  2)通过一个引用对数据的修改会影响另一个引用对数据的访问
    eg:房子钥匙
  基本类型变量画等号:
  1)赋值
  2)对一个变量的修改不会影响另一个变量的访问
    eg:身份证复印件


练习:
1)画图
2)将今天的项目代码在昨天基础之上重做两次

 


房子:对象
房子钥匙:引用
配一把钥匙:引用


内存管理:由JVM来管理的
1)堆:new出来的对象(包括成员变量)
2)栈:局部变量(包括方法的参数)
3)方法区:.class字节码文件(包括方法)


void show(int a){
  double b = 34.567;
}

Student zs = new Student();


x = (int)(Math.random()*(400-this.width));

Random rand = new Random();
x = rand.nextInt(400-this.width);


y = 


class Student{
  String name;
  int age;
  String address;

Student zs = new Student("zhangsan"); //zhangsan,0,null
Student zs = new Student("zhangsan",25); //zhangsan,25,null
Student zs = new Student("zhangsan",25,"LF"); //zhangsan,25,LF


Student zs = new Student("zhangsan",25); //zhangsan,25,null
Student zs = new Student("zhangsan"); //zhangsan,0,null

  Student(String name){
    this(name,0);
  }
  Student(String name,int age){
    this(name,age,null);
  }
  Student(String name,int age,String address){
    this.name = name;
    this.age = age;
    this.address = address;
  }
}


Student zs = new Student("zhangsan",25,"LF");
Student ls = new Student("lisi",26,"JMS");

class Student{
  String name;
  int age;
  String address;
  Student(String name,int age,String address){
    this.name = name;        //ls.name="lisi"
    this.age = age;          //ls.age=26
    this.address = address;  //ls.address="JMS"
  }
}


就近原则
当成员变量与局部变量同名时,this不能省略
class Student{
  String name; //成员变量
  int age;
  String address;
  Student(String name,int age,String address){ //局部变量
    this.name = name;
    this.age = age;
    this.address = address;
  }

  void study(){
    System.out.println(name+"在学习...");
  }
  void sayHi(){
    System.out.println("大家好,我叫"+name+",今年"+age+"岁了,家住"+address);
  }
}


Student zs = new Student();
zs.name = "zhangsan";
zs.age = 25;
zs.address = "LF";
zs.study();
zs.sayHi();

Student ls = new Student();
ls.name = "lisi";
ls.age = 26;
ls.address = "JMS";
ls.study();
ls.sayHi();

Student ww = new Student();
ww.study();
ww.sayHi();

class Student{
  String name=null;
  int age=0;
  String address=null;

  void study(){          ww.name
    System.out.println(this.name+"在学习...");
  }
  void sayHi(){                         ww.name            ww.age                ww.address
    System.out.println("大家好,我叫"+this.name+",今年"+this.age+"岁了,家住"+this.address);
  }
}

class Student{
  String name;
  int age;
  String address;
  Student(){
  }
  //给成员变量赋初值
  Student(String name1,int age1,String address1){
    name = name1;
    age = age1;
    address = address1;
  }
}

Student zs = new Student();
Student zs = new Student("zhagnsan",25,"LF");


class Student{
  String name;
  int age;
  String address;
  //给成员变量赋初值
  Student(String name1,int age1,String address1){
    name = name1;
    age = age1;
    address = address1;
  }
}

Student zs = new Student(); //编译错误
Student zs = new Student("zhangsan",25,"LF");


Student zs = new Student("zhangsan",25,"LF");
Student ls = new Student("lisi",26,"JMS");

class Student{
  String name;
  int age;
  String address;
  //给成员变量赋初值
  Student(String name1,int age1,String address1){
    name = name1;
    age = age1;
    address = address1;
  }
}

//1)创建一个学生对象
//2)给成员变量赋默认值
//3)调用Student类的构造方法
Student zs = new Student();

Student zs = new Student();
zs.setInfo("zhangsan",25,"河北廊坊");

Student ls = new Student();
ls.setInfo("lisi",26,"黑龙江佳木斯");

Student zs = new Student();
zs.name = "zhangsan";
zs.age = 25;
zs.address = "河北廊坊";

Student ls = new Student();
ls.name = "lisi";
ls.age = 26;
ls.address = "黑龙江佳木斯";


void println(){
}
void println(int a){
}
void println(double a){
}
void println(boolean a){
}
void println(char a){
}
void println(String a){
}

System.out.println();
System.out.println(23);
System.out.println(35.7);
System.out.println(true);
System.out.println('你');
System.out.println("Hello");


 

# 高校智慧校园解决方案摘要 智慧校园解决方案是针对高校信息化建设的核心工程,旨在通过物联网技术实现数字化校园的智能化升级。该方案通过融合计算机技术、网络通信技术、数据库技术和IC卡识别技术,初步实现了校园一卡通系统,进而通过人脸识别技术实现了更精准的校园安全管理、生活管理、教务管理和资源管理。 方案包括多个管理系统:智慧校园管理平台、一卡通卡务管理系统、一卡通人脸库管理平台、智能人脸识别消费管理系统、疫情防控管理系统、人脸识别无感识别管理系统、会议签到管理系统、人脸识别通道管理系统和图书馆对接管理系统。这些系统共同构成了智慧校园的信息化基础,通过统一数据库和操作平台,实现了数据共享和信息一致性。 智能人脸识别消费管理系统通过人脸识别终端,在无需接触的情况下快速完成消费支付过程,提升了校园服务效率。疫情防控管理系统利用热成像测温技术、视频智能分析等手段,实现了对校园人员体温监测和疫情信息实时上报,提高了校园公共卫生事件的预防和控制能力。 会议签到管理系统和人脸识别通道管理系统均基于人脸识别技术,实现了会议的快速签到和图书馆等场所的高效通行管理。与图书馆对接管理系统实现了一卡通系统与图书馆管理系统的无缝集成,提升了图书借阅的便捷性。 总体而言,该智慧校园解决方案通过集成的信息化管理系统,提升了校园管理的智能化水平,优化了校园生活体验,增强了校园安全,并提高了教学和科研的效率。
public String repairApply(String orderId, String repairId, String lastTime) { LoginUser loginUser = SecurityUtils.getLoginUser(); Map<String, Object> map = repairResumeMapper.selectAllById(repairId); if(!"1".equals(map.get("repair_state"))) { return "申请已被处理"; } if(orderMapper.selectExclusive(orderId, lastTime) == 0) { return "订单发生变更,请刷新页面重新操作"; } Map<String, Object> orderInfo = orderMapper.selectOrderById(Long.parseLong(orderId)); String type = orderInfo.get("order_no_type").toString(); String fType = orderInfo.get("fabrics").toString(); String genNo = ""; if("SU".equals(type)) { genNo = "SU0"; } else { genNo = type + ("3".equals(fType) ? "6" : "8"); } String no = genNoService.genOrderNo(genNo); if(no == null) { return "订单编号超出最大数量限制"; } String day = DictUtils.getDictLabel("delivery_time", fType); Date d = DateUtils.addDays(DateUtils.getNowDate() , Integer.parseInt(day)); Date deTime = DateUtils.parseDate(DateUtils.dateTime(d)); OrderInfo param = new OrderInfo(); param.setOrderNo(no); param.setCreateBy(loginUser.getUsername()); param.setId(orderId); param.setDeliveryTime(deTime); repairResumeMapper.insertRepairOrder(param); OrderFileAsso of = new OrderFileAsso(); of.setOrderId(Long.parseLong(param.getUuid())); of.setFileId(Long.parseLong(map.get("file_id").toString())); of.setFileState("3"); of.setOrderState("2"); fileMapper.insertOrderFileAsso(of); OrderInfo oo = new OrderInfo(); oo.setUuid(orderId); oo.setRepairState("2"); oo.setUpdateBy(loginUser.getUsername()); orderMapper.updateOrder(oo); RepairResume repairResume = new RepairResume(); repairResume.setId(Long.parseLong(repairId)); repairResume.setRepairState("3"); repairResume.setUpdateBy(loginUser.getUsername()); repairResumeMapper.update(repairResume); return ""; }翻译这段代码
06-03
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值