Lruihao

Lruihao's Note

不怕萬人阻擋,只怕自己投降

Lruihao's Github chart

JS 验证码


请点击验证码处:↑

java 继承 test

引用

继承的好处:

  1. 提高了代码的复用性
  2. 提高了代码的维护性
  3. 让类与类之间产生了关系,是多态的前提

继承的弊端:类的耦合性很强

设计原则:低耦合,高内聚。

  • 耦合:类与类的关系。
  • 内聚:自己完成事情的能力。

利用腾讯云对象存储 COS 桶托管 hexo 博客

本以为 coding pages 与腾讯云合作后会更好,没想到正是这种初期 bug 不断,速度也是非常慢。比 gitee, 甚至 github 都要慢很多了。所以决定放弃 coding 了,本想挂到云服务器上,但是这个云服务器只续费了半年,可能不会再续费,前几天看到用腾讯云的 cos 桶 xml 制作动态相册的文章,知道了对象存储这个玩意,腾讯云 COS 提供免费 50G 的存储空间,还有 CDN 加速服务,我觉得是个不错的选择,部署后发现速度还挺好。
适用于 hexo, hugo 等静态博客的部署。

Arrays 类及基本使用

1 主要方法

  • static type[] copyof(type[] original,int length)
  • static int binarysearch(type[] a,type key)
  • static boolean equals(type[] a,type[] b)
  • static void fill(type[] a,type val)
  • static void fill(type[] a,int fromindex,int toindex,type val)
  • static void sort(type[] a)

在搜索、文章底部、侧栏添加最近文章模块

首先在主题配置文件添加以下关键字 1 2 3 4 5 6 7 8 recent_posts: enable: true search: true post: false sidebar: false icon: history title: 近期文章 layout: block 1 侧栏在 next/layout/_macro/sidebar.swig 中的 if theme.links 对应的 endif 后面。 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 {% if theme.recent_posts.enable and theme.recent_posts.sidebar %} <div class="links-of-blogroll motion-element {{ "links-of-blogroll-" + theme.recent_posts.layout }}"> <div class="links-of-blogroll-title"> <i class="fa fa-history fa-{{ theme.recent_posts.icon | lower }}" aria-hidden="true"></i> {{ theme.recent_posts.title }} </div> <ul class="links-of-blogroll-list"> {% set posts = site.posts.sort('-date') %} {% for post in posts.slice('0', '3') %} <li> <a href="{{ url_for(post.path) }}" title="{{ post.title }}" target="_blank">{{ post.title }}</a> </li> {% endfor %} </ul> </div> {% endif %} 2 搜索结果处添加找到路径

java 猜数字小游戏(Math 类)

大一刚学 c 的时候以前写过 c 语言版 的。

  1. Math: 针对数学进行运算的类
  2. 特点:没有构造方法,因为它的成员都是静态的
  3. 产生随机数: public static double random(): 产生随机数,范围 [0.0,1.0)
  4. 产生 1-100 之间的随机数 int number = (int)(Math.random()*100)+1;
  5. 猜数字小游戏案例

面向对象基础知识总结

1 面向对象思想(理解) 面向对象是基于面向过程的一种编程思想 思想特点: A: 是一种更符合我们思考习惯的思想 B: 把复杂的问题简单化 C: 让我们从执行者变成了指挥者 举例: A: 洗衣服 B: 吃饭 C: 买电脑 举例并代码体现 把大象装进冰箱 2 类与对象(掌握) 我们学习编程是为了把现实世界的事物用编程语言描述来实现信息化。 现实世界事物是如

java 水仙花数(循环)

水仙花数(Narcissistic number)也被称为超完全数字不变数(pluperfect digital invariant, PPDI)、自恋数、自幂数、阿姆斯壮数或阿姆斯特朗数(Armstrong number),水仙花数是指一个 3 位数,它的每个位上的数字的 3 次幂之和等于它本身(例如:1^3 + 5^3+ 3^3 = 153)。

java 录入数据

1 记忆格式(1) 导包: import java.util.Scanner; 注意:位置在 class 的上面。 (2) 创建键盘录入对象: Scanner sc = new Scanner(System.in); (3) 获取数据 int i = sc.nextInt(); (4) 练习: A: 求两个数据的和 B: 获取两个数据中较大的值 C: 获取三个数据中较大的值 D: 比较两个数是否相等 2 实例 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 package helloworld; import java.util.Scanner; public class helloworld { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int i=sc.nextInt(),j=sc.nextInt(),k=sc.nextInt(); sc.close(); System.out.println(i+"+"+j+"="+(i+j));
0%