miluframe({ /*个人链接地址*/ Youself:'https://www.cnblogs.com/miluluyo/', /*导航栏信息*/ custom:[{ name:'留言板', link:'https://www.cnblogs.com/miluluyo/p/11578505.html', istarget:false },{ name:'技能树', link:'https://miluluyo.github.io/', istarget:true }], /*自己的友链页面后缀*/ Friends_of_the:'p/11633791.html', /*自己的友链信息*/ resume:{ "name":"麋鹿鲁哟", "link":"https://www.cnblogs.com/miluluyo", "headurl":"https://images.cnblogs.com/cnblogs_com/elkyo/1558759/o_o_my.jpg", "introduction":"大道至简,知易行难。" }, /*友链信息*/ unionbox:[{ "name":"麋鹿鲁哟", "introduction":"生活是没有标准答案的。", "url":"https://www.cnblogs.com/miluluyo", "headurl":"https://images.cnblogs.com/cnblogs_com/elkyo/1558759/o_o_my.jpg" },{ "name":"麋鹿鲁哟的技能树", "introduction":"大道至简,知易行难。", "url":"https://miluluyo.github.io/", "headurl":"https://images.cnblogs.com/cnblogs_com/elkyo/1558759/o_o_my.jpg" }], /*点击页面时候的弹出文本显示*/ clicktext:new Array("ヾ(◍°∇°◍)ノ゙加油哟~ ——麋鹿鲁哟","生活是没有标准答案的。 ——麋鹿鲁哟"), /*github链接*/ githuburl:'https://github.com/miluluyo' })

2022.07.19 第三小组 陈迪 学习笔记

面向对象的特征:

1、this关键字:

this代表当前类的对象,代表当前方法的调用者
this既然是代表方法的调用者,它实际和对象的作用是一样的
既可以调属性,也可以调方法,当使用对象调用属性时,调用的是成员变量

要求:
不需要写任何的名字,必须在构造器中调用构造器,还需要是第一句话
不能用在static的方法中
开发中,this通常用在什么位置
构造器赋值

2、封装:

2.1、代码层面

(1)、属性私有化,所有的属性都要使用private封装

(2)、提供一个公有的set,get方法

getter方法能够按照客户的期望返回格式化的数据

setter方法可以限制和检验setter方法传入的参数是否合法

隐藏对象的内部结构

2.2、思想层面

把一堆重复执行的代码封装成方法,把一堆重复执行的方法封装成一个类

2.3、以后的赋值操作:

  1. 不再使用对象.属性的方法
  2. 使用构造器
  3. setter方法

2.4、习惯:

必须保证每个类都有一个无参构造器

实例:

public class Dog {
    private String color;
    private int age;
    public Dog() {}
    public Dog(String color, int age) {
        this.color = color;
        this.age = age;
    }
    public void show() {
        System.out.println(color + age);
    }
}
public class Ch01 {
    public static void main(String[] args) {
        Dog dog=new Dog("we",12);
dog.show();
    }
}

心得体会:

今天学习了this关键字和封装,对this关键字理解较好,对封装理解较差,不太会方法的调用和传参,逻辑较差,作业需要在同学的指导下才能完成,希望可以继续努力。

posted @ 2022-07-19 22:51  jinjidecainiao  阅读(44)  评论(0)    收藏  举报
@media only screen and (max-width: 767px){ #sidebar_search_box input[type=text]{width:calc(100% - 24px)} } L2Dwidget.init({ "model": { jsonPath: "https://unpkg.com/live2d-widget-model-hijiki/assets/hijiki.model.json", "scale": 1 }, "display": { "position": "left", "width": 100, "height": 200, "hOffset": 70, "vOffset": 0 }, "mobile": { "show": true, "scale": 0.5 }, "react": { "opacityDefault": 0.7, "opacityOnHover": 0.2 } }); window.onload = function(){ $("#live2dcanvas").attr("style","position: fixed; opacity: 0.7; left: 70px; bottom: 0px; z-index: 1; pointer-events: none;") } 参数说明 名称 类型 默认值/实例 描述Youself 字符串 https://www.cnblogs.com/miluluyo/ 个人博客园首链接 custom 数组 [{ name:'相册', link:'https://www.cnblogs.com/elkyo/gallery.html', istarget:false },{ name:'技能树', link:'https://miluluyo.github.io/', istarget:true },{ name:'留言板', link:'https://miluluyo.github.io/p/11578505.html', istarget:false }] 导航信息 name 导航名 link 导航链接 istarget true跳转到新页面上,false当前页面打开 Friends_of_the 字符串 11633791 友链文章的后缀名,若字符串为空则不显示友链 resume 对象 { "name":"麋鹿鲁哟", "link":"https://www.cnblogs.com/miluluyo/", "headurl":"https://images.cnblogs.com/cnblogs_com/ elkyo/1558759/o_o_my.jpg", "introduction":"大道至简,知易行难。" } 自己的友链信息 name 导航名 link 导航链接 headurl 头像 introduction 语录 unionbox 数组 [{ "name":"麋鹿鲁哟", "introduction":"生活是没有标准答案的。", "url":"https://www.cnblogs.com/miluluyo", "headurl":"https://images.cnblogs.com/cnblogs_com/ elkyo/1558759/o_o_my.jpg" },{ "name":"麋鹿鲁哟的技能树", "introduction":"大道至简,知易行难。", "url":"https://miluluyo.github.io/", "headurl":"https://images.cnblogs.com/cnblogs_com/ elkyo/1558759/o_o_my.jpg" }] 友链数组 name 昵称 introduction 标语 url 链接地址 headurl 头像地址 clicktext 新数组 new Array("ヾ(◍°∇°◍)ノ゙加油哟~ ——麋鹿鲁哟", "生活是没有标准答案的。 ——麋鹿鲁哟"), 点击页面时候的弹出显示 githuburl 字符串 https://github.com/miluluyo github链接