连轴转啊,每天都。
论文也要推进度,组会两星期一次,现在都是在还剩一个星期,针对上次组会的发展路线继续做,高效率的寻找一些改进方式,比如接下来要做的是小波脊和降噪处理。
昨天想问问心中的白月光和红玫瑰,圣诞能不能送礼物。有些时候那种痛苦来临真的就是像雾,突然就笼罩在你身上了,压得你看不到方向,又让我明白,实际上不是我想要,而是她愿意。
上次学到了面向对象的前部,最近把面向对象全部学完了,刚刚学习完的是线程的安全、同步。
有些问题出现了,比如的确需要大量的代码练习,项目三必须要再做两遍。
按照上次结束的接着做一下回顾:
1.明确了思路,开始了Leetcode刷题
这段时间开始了数据结构和算法的学习,一直不能停下,在基础完成后,下一步是数据库的学习。
按照数据结构的分类逐步刷算法题。
2.继承 extends
子类 父类
构造器
子类可以设置自己的构造器,方法内部直接调用父类方法;
public Architect(int id, String name, int age, double salary, Equipment equipment, double bonus, int stock) {
super(id, name, age, salary, equipment, bonus);
this.stock = stock;
}
方法
子类 可以重写父类方法 默认用自己的
如果要用父类中的,super().
继承的父类的 实现的 接口里的抽象方法 必须要重写
@Override
public String toString() {
// TODO Auto-generated method stub
return getDetails()+"\t架构师\t"+getStatus()+"\t"+getBonus()+"\t"+stock+"\t"+getEquipment().getDescription();
}
3.多态性
这里就体现了多态性,抽象方法
定义一个接口 学习
小学生学习 大学生学习 本科生学习 硕士生学习
大家都实现 但是要重写 学习方法
可以直接造子类对象,调用父类方法
//walk eat 都是父类 Person中方法
Persron p=new Man();
p.eat(); p.walk();
4.instatnce of 关键词
判断 A 是不是 B的子类;
很有用!!!
可以作为分类关键词使用
5.equals 与 == 的区别
equals判断String是否相等
==是判断int型
6.equals可以重写 用的少
7.@Test模式
进入调试模式
Ecli-build Path -add libraies-junit 4-next
进入后 逐步执行 进入 出来
8.快捷键
ecli alt+/
idaa sout psvm
9.封装性!
包装类
Byte Short Integer Long Flont Double Boolean Character
意义就是:数字 变成类了 类可以造对象!
class A{
Double a= new Double();
a.getdouble();
}
从高往低可以自动转 Int garde=Integer number;
10.转换过程
Object obj=V.elementAt(i);
Integer InScore=(Integer)obj;
int level=InScore.intValue();
int num=Integer.parseInt();
11.static 关键词 固有类
static final配一块 常量
功能:
修饰属性.方法,块,内部类
静态元素在类class加载的时候就被初始化,创建的很早,那时还没有创建对象
静态元素存储在静态元素区中,每一个类都有自己的一个单独的区域,与别的类不冲突
静态元素区不能被GC管理,可以简单的认为静态元素常驻内存
静态元素只加载一次,供全部的类对象和类本身共享
可以理解为静态元素与对象没有关系,它属于类
由于静态元素在加载的时候可能还没有创建对象,我们可以直接通过类名直接静态元素
静态元素可以直接访问静态元素。
非静态元素可以直接方法静态元素,但是静态元素不能直接方法非静态元素
静态元素中不可以使用this,super关键字
12.单例设计模式 目的:只能存在一个对象!!!!!!!
需要会手写
//懒汉式
class Order{
private Order(){
}
//该对象也必须未static
private static Order instatnce=null;
//静态的返回当前类的方法
public Order getInstatnce(){
if(instatnce==null){
instatnce=new Order();
}
return instatnce;
}
}
//饿汉式
class Bank{
//1.private builder
private Bank(){
}
//2.内部创建一个对象 静态
private static Bank instance=new Bank();
//3.public method to get tihs obj 静态的
public static Bank getInstance(){
return instance;
}
13.main方法
可以带形参赋值
14.{} 代码块
静态 非静态
静态 类生就有
非静态 对象生就有
15.final 最终的不变常量
16.抽象
抽象类 人
对象 男 对象女
不可以自己造对象 子类来实现
方法
子类怎么吃? 男的怎么吃 女的怎么吃?
只有方法名 子类来重写
public abstract eat();
一定要设置构造器 供子类调用 重写
17. Interface 接口
类似 class 一个级别
可以继承
没有构造器 无法实例化!
抽象方法
来实现而已 记住
public class CommonEmployee extends Employee {
@Override
public void work() {
// TODO Auto-generated method stub
System.out.println("do his work");
}
}
18.局部内部类
19.异常处理
package Error;
public class EcmDef {
public static void main(String[] args) {
try{
int i =Integer.parseInt(args[0]);
int j =Integer.parseInt(args[1]);
int result=ecm(i,j);
System.out.println(result);
}catch(NumberFormatException e){
System.out.println("数据类型不一致");
}catch(ArrayIndexOutOfBoundsException e){
System.out.println("缺少命令行参数");
}catch(ArithmeticException e){
System.out.println("除0");
}catch(EcDef e){
System.out.println(e.getMessage());
}
}
public static int ecm(int i,int j) throws EcDef{
if(i<0||j<0){
throw new EcDef("分子或者分母为负数");
}
return i/j;
}
}
package Error;
public class EcDef extends Exception{
//定义异常
static final long serialVersionUID = -3387516993124229948L;
public EcDef(){}
public EcDef(String msg){
super(msg);
}
}
20.项目三思考
21.idea使用
22.线程 程序 进程
23.线程关键字
join()
sleep()
start()
24.构建线程的两种方式
package thread;
/**
* @author wby
* @create 2021-12-20 21:04 thread - the name of the target package where the new class or interface will be created. project01 - the name of the current project. ${FILE_NAME} - the name of the PHP file that will be created. ThreadTest - the name of the new file which you specify in the New File dialog box during the file creation. ps - the login name of the current user. 2021/12/20 - the current system date. 21:04 - the current system time. 2021 - the current year. 12 - the current month. 20 - the current day of the month. 21 - the current hour. 04 - the current minute. IntelliJ IDEA - the name of the IDE in which the file will be created. 十二月 - the first 3 letters of the month name. Example: Jan, Feb, etc. 十二月 - full name of a month. Example: January, February, etc
*/
public class ThreadTest {
public static void main(String[] args){
//3.创建Thread类的对象
Mythread t1=new Mythread();
t1.start();
System.out.println("I lose everything");
}
}
//1.Thread创建子类
class Mythread extends Thread{
//2.重写Thread中的run()方法---------将线程执行操作,声明在run方法中
@Override
public void run() {
for(int i=0;i<100;i++){
if(i%2==0){
System.out.println(i);
}
}
}
}
package thread;
/**
* @author shkstart
* @create 2021-12-20 23:39 thread - the name of the target package where the new class or interface will be created. project01 - the name of the current project. ${FILE_NAME} - the name of the PHP file that will be created. ThreadTest2 - the name of the new file which you specify in the New File dialog box during the file creation. ps - the login name of the current user. 2021/12/20 - the current system date. 23:39 - the current system time. 2021 - the current year. 12 - the current month. 20 - the current day of the month. 23 - the current hour. 39 - the current minute. IntelliJ IDEA - the name of the IDE in which the file will be created. 十二月 - the first 3 letters of the month name. Example: Jan, Feb, etc. 十二月 - full name of a month. Example: January, February, etc
*/
public class ThreadTest2 {
public static void main(String[] args){
//3.创建实现class的对象
Thread2 thread2=new Thread2();
//4.对象作为参数 传递至 Thread的构造器中
Thread thread=new Thread(thread2);
Thread thread1=new Thread(thread2);
//5.用构造出的Thread类型的对象 thread 调用 方法!
thread.start();
thread1.start();
}
}
//1.创建实现接口的class
class Thread2 implements Runnable{
//2.重写实现的主方法
@Override
public void run() {
for(int i=0;i<=100;i++){
if(i%2==0){
System.out.println(i);
}
}
}
}
25.Thread extends 和 implements Runnable 的思考
Runnable 利用构造器 寻找共同数据
唉 希望有机会可以寻找自己心中的幻影!

被折叠的 条评论
为什么被折叠?



