当前位置: 首页 > news >正文

外贸做独立网站怎么样/北京seo排名收费

外贸做独立网站怎么样,北京seo排名收费,wordpress responsive lightbox,网站开发 精品课程第二章 方法带参 课前回顾 1.描述类和对象的关系 类是一组对象的共有特征和行为的描述。对象是类的其中一个具体的成员。 2.如何创建对象 类名 对象名 new 类名();3.如何定义和调用方法 public void 方法名(){}对象名.方法名();4.成员变量和局部变量的区别 成员变量有初…

第二章 方法带参

课前回顾

1.描述类和对象的关系

类是一组对象的共有特征和行为的描述。对象是类的其中一个具体的成员。

2.如何创建对象

类名 对象名 = new 类名();

3.如何定义和调用方法

public void 方法名(){}对象名.方法名();

4.成员变量和局部变量的区别

成员变量有初始值,而局部变量没有初始值。因此,局部变量在使用之前必须完成初始化。成员变量在整个类中可见,而局部变量只能在其所定义的方法中可见。因此,如果在方法中出现了与成员变量同名的局部变量,此时局部变量的优先级更高。

5.如何理解this关键字

this 关键字表示当前对象。那么当前对象究竟是什么?哪一个对象使用new关键字,那么this就指向哪个对象

Car c = new Car(); // this => cCar c1 = new Car(); //this => c1

第一节 方法带参

1.构造方法带参

案例场景

现有计算机类定义如下:

public class Computer{public String brand;//品牌public String type;//型号public double price;//价格
}

现要创建3个具体的计算机实例,代码如下:

public class ComputerText {public static void main(String[] args){Computer c1 = new Computer();c1.brand = "联想";c1.type = "T430";c1.price = 5000;Computer c2 = new Computer();c2.brand = "联想";c2.type = "w530";c2.price = 6000;Computer c3 = new Computer();c3.brand = "联想";c3.type = "T450";c3.price = 7000;}
}

思考:以上代码存在什么问题?

我们会发现没创建一个对象,都会出现重复为对象的属性赋值,这样造成大量的冗余代码。可以使用带参构造方法来进行优化。

构造方法带参语法

访问修饰符 类名(数据类型1 变量名1,数据类型2 变量名2,...数据类型n 变量名n){}

示例

/*** 计算机类**/
public class Computer {public String brand;//品牌public String type;//型号public double price;//价格//如果一个类中没有定义任何构造方法,那么编译器会自动为这个类添加一个默认的无参构造方法//如果一个类中已经定义了构造方法,那么编译器不会自动为这个类添加默认的无参构造方法//如果一个类中已经定义了带参数构造方法,此时还想使用无参的构造方法,那么必须将无参构造方法也定义出来public Computer(){}//此时在类中定义了带参数的构造方法,那么编译器不会自动为这个类添加默认的无参构造方法//构造方法的()中表示的是参数列表,这里的列表是形式参数public Computer(String brand, String type, double price){this.brand = brand;this.type = type;this.price = price;}
}
public class ComputerText {public static void main(String[] args){Computer c1 = new Computer();
//        c1.brand = "联想";
//        c1.type = "T430";
//        c1.price = 5000;//调用带参构造方法创建对象时,必须注意参数列表传递的值要与构造方法定义时的值一一对应//传递的参数是实参,也就是形式参数的一个具体实例Computer c4 = new Computer("联想","T430",5000);Computer c2 = new Computer();
//        c2.brand = "联想";
//        c2.type = "w530";
//        c2.price = 6000;Computer c5 = new Computer("联想","w530",6000);Computer c3 = new Computer();
//        c3.brand = "联想";
//        c3.type = "T450";
//        c3.price = 7000;Computer c6 = new Computer("联想","T450",7000);}
}

练习

定义书籍名(名称、出版社、出版年月、价格)并使用带参构造方法创建对象

/*** 书籍类**/
public class Book {public String name; //书名public String publishHome; //出版社public String data; //出版年月public double price; //价格public Book(String name,String publishHome,String data,double price){this.name = name;this.publishHome = publishHome;this.data = data;this.price = price;}
}
public class BookTest {public static void main(String[] args) {//作者乱编的哈~Book b = new Book("云边有个小卖部","不知道出版社","2017/7/7",40);}
}

2.方法带参

方法带参语法

//[]中的内容可有可无
访问修饰符 返回值类型 方法名(数据类型1 变量名1,数据类型2 变量名2,...数据类型n 变量名n){[return 返回值]
}
//带参方法调用
对象名.方法名(实参1,实参2,...实参3);

return关键字的作用就是给出方法执行的结果,使得方法直接结束

案例场景

现有计算器类的定义如下:

public class Calculator {public int number1;public int number2;public String operator;/*** 访问修饰符 返回值类型 方法名(数据类型1 变量名1,数据类型2 变量名2,...数据类型n 变量名n){*     [return 返回值]* }** return关键字的作用就是给出方法执行的结果,使得方法直接结束*///calculate方法执行完成后必须要返回一个int类型的值//如果一个方法的返回值类型不为void,那么在选择结构中,必须要为每一种情况都提供一个返回值public int calculate(){switch(operator){case "+":return number1 + number2;case "-":return number1 - number2;case "*":return number1 * number2;case "/":return number1 / number2;default:return 0;}}
}

某商家有30件啤酒,每件价格72元,商家在3天内卖完这30件啤酒,请问每天卖了多少钱?

/*** 某商家有30件啤酒,每件价格72元,商家在3天内卖完这30件啤酒,请问每天卖了多少钱?**/
public class Calculator {public int number1;public int number2;public String operator;public Calculator(){}public int calculate(){switch(operator){case "+":return number1 + number2;case "-":return number1 - number2;case "*":return number1 * number2;case "/":return number1 / number2;default:return 0;}}
}public class CalculatorTest {public static void main(String[] args) {Calculator c = new Calculator();//构造一个计算器c.number1 = 30;c.number2 = 72;c.operator = "*";int total = c.calculate();//计算总收入c.number1 = total;c.number2 = 3;c.operator = "/";int avg = c.calculate();//计算每天的平均收入System.out.println("每天卖了" + avg + "元");}
}

思考:以上代码存在什么问题?

依然是为对象的属性重复赋值的问题,可以使用构造方法来解决

/*** 某商家有30件啤酒,每件价格72元,商家在3天内卖完这30件啤酒,请问每天卖了多少钱?**/
public class Calculator {public int number1;public int number2;public String operator;public Calculator(){}public Calculator(int number1,int number2,String operator){this.number1 = number1;this.number2 = number2;this.operator = operator;}public int calculate(){switch(operator){case "+":return number1 + number2;case "-":return number1 - number2;case "*":return number1 * number2;case "/":return number1 / number2;default:return 0;}}
}public class CalculatorTest {public static void main(String[] args) {Calculator c = new Calculator();//构造一个计算器c.number1 = 30;c.number2 = 72;c.operator = "*";int total = c.calculate();//计算总收入c.number1 = total;c.number2 = 3;c.operator = "/";int avg = c.calculate();//计算每天的平均收入System.out.println("每天卖了" + avg + "元");//用构造方法带参优化Calculator c1 = new Calculator(30,70,"*");int result1 = c.calculate();Calculator c2 = new Calculator(result1,3,"/");int result2 = c.calculate();System.out.println("每天卖了" + result2 + "元");}
}

仔细解读上面的代码,是否还存在问题?

上面的代码确实进行了优化,但是与现实生活不符。在现实生活中,要进行计算,只需要一台计算器即可,这里使用了两台计算器才能完成简单的计算功能。在这里还需要对代码进行改造,以满足实际生活的需要。可以使用带参方法来优化。

/*** 某商家有30件啤酒,每件价格72元,商家在3天内卖完这30件啤酒,请问每天卖了多少钱?**/
public class Calculator {public int calculate(int number1,int number2,String operator){switch(operator){case "+":return number1 + number2;case "-":return number1 - number2;case "*":return number1 * number2;case "/":return number1 / number2;default:return 0;}}
}
public class CalculatorTest {public static void main(String[] args) {Calculator c = new Calculator();int total = c.calculate(30,72,"*");int avg = c.calculate(total,3,"/");System.out.println("每天卖了" + avg + "元");}
}

练习

使用方法实现求任意数的阶乘。

import org.w3c.dom.ls.LSOutput;import java.util.Scanner;public class JieChengTest {public static void main(String[] args) {int number = 0;int result = 0;Scanner sc = new Scanner(System.in);System.out.println("请输入一个数:");while(true) {if (sc.hasNextInt()) {number = sc.nextInt();JieCheng j = new JieCheng();result = j.jiecheng(number);break;} else {System.out.println("你输入的不是整数,请输入一个整数:");sc.next();}}System.out.println("这个数的阶乘是" + result);}
}

使用方法实现判断一个数是否为素数。

public class IsPrime {public boolean isprime(int n){if(n == 2){return true;} else {for(int i=2; i<n; i++){if(n % i == 0){return true;}}}return false;}
}
import java.util.Scanner;public class IsPrimeTest {public static void main(String[] args) {Scanner sc = new Scanner(System.in);System.out.println("请输入一个整数:");while(true){if(sc.hasNextInt()){int number = sc.nextInt();IsPrime p = new IsPrime();if(p.isprime(number)){System.out.println(number + "不是素数");} else {System.out.println(number + "是素数");}break;} else{System.out.println("你输入的不是一个整数,请输入一个整数:");sc.next();}}}
}

3.对象数组

对象数组语法

类名[] 对象名 - new 类名[数组长度];//创建一个对象数组

案例场景

学生有姓名和年龄,类定义如下:

public class Student{public String name;public int age;public Student(String name,int age){this.name = name;this.age = age;}
}

一个班级有多个学生,如何存储这些学生的信息?使用数组存储

public class StudentTest {public static void main(String[] args) {Student[] students = new Student[2];students[0] = new Student("张三",20);students[1] = new Student("李四",25);}
}

在这里插入图片描述

练习

使用对象数组存储学生选择的5门必修课程(课程编号、课程名称、学分)

/*** 课程类**/
public class Course {public int number;public String name;public double score;public Course(int number,String name,double score){this.number = number;this.name = name;this.score = score;}
}
public class CourseTest {public static void main(String[] args) {Course[] courses = new Course[5];courses[0] = new Course(01,"数学",150);courses[1] = new Course(02,"语文",150);courses[2] = new Course(03,"英语",150);courses[3] = new Course(04,"化学",100);courses[4] = new Course(05,"生物",100);}
}

使用对象数组存储5个菜单信息(菜单编号、菜单名称)

/*** 菜单类**/
public class Menu {public int number;public String name;public Menu(int number,String name){this.number = number;this.name = name;}
}
public class MenuTest {public static void main(String[] args) {Menu[] menus = new Menu[5];menus[0] = new Menu(01,"黄焖鸡米饭");menus[1] = new Menu(02,"土家酱香饼");menus[2] = new Menu(03,"土豆泥拌面");menus[3] = new Menu(04,"公安锅盔");menus[4] = new Menu(05,"麻辣牛肉");}
}

4.引用数据类型作为方法的参数

案例场景

某手机专卖店有100个手机展架,售货员现在依次向展架上摆放手机。请使用面向对象的设计思想描述这一过程。(手机有品牌、型号和价格)

分析

a.这一过程涉及到的对象有两个,一个是手机,一个是售货员,因此我们需要为这两个对象构建类

b.摆放手机是售货员的一个行为,因此需要使用方法来描述

c.100个手机展架放的都是手机,因此需要使用对象数组来存储

代码实现

public class Mobine {public String brand;public String type;public double price;public Mobine(String brand,String type,double price){this.brand = brand;this.type = type;this.price = price;}
}
public class Saler {//数组中的默认值都是nullpublic Mobine[] mobines = new Mobine[100];/*** 引用数据类型作为方法的参数**/public void palyMobine(Mobine mobine){for(int i=0; i<mobines.length; i++){if(mobines[i] == null){mobines[i] = mobine;break;}}}
}
public class SalerTest {public static void main(String[] args) {Saler saler = new Saler();//调用售货员放手机saler.palyMobine(new Mobine("小米","小米10",2000));}
}

练习

某老师现要录入班级学生信息(姓名,性别,年龄,成绩),学生信息存储在数组中。请使用方法完成。

分析:

a.涉及的对象(具体的事物):老师和学生,需要构建两个类来描述这样的对象的共同特征和行为举止

b.录入班级学生信息是老师的行为

c.学生信息存储在数组中

import java.util.Arrays;
import java.util.Scanner;public class Stu {public String name;public String sex;public int age;public double score;public Stu(String name,String sex,int age,double score){this.name = name;this.sex = sex;this.age = age;this.score = score;}
}
public class Teacher {public Stu[] stus = {}; //刚开始的时候 一个学生也没有public void addStu(Stu stu){//添加一个学生信息stus = Arrays.copyOf(stus,stus.length + 1); //先对数组进行扩容stus[stus.length - 1] = stu;}
}public class TeacherTest {public static void main(String[] args) {Scanner sc = new Scanner(System.in);Teacher t = new Teacher(); //一位老师for(int i=0; i<3; i++){ //输入3个学生的信息System.out.println("请输入学生姓名:");String name = sc.next();System.out.println("请输入学生性别:");String sex = sc.next();System.out.println("请输入学生年龄:");int age = sc.nextInt();System.out.println("请输入学生成绩:");double score = sc.nextDouble();
//            Stu stu = new Stu(name,sex,age,score);
//            t.addStu(stu);t.addStu(new Stu(name,sex,age,score));//将上面两步可以合二为一}}
}

5.数组作为方法的参数

案例场景

现有甲乙丙三个班级成绩统计如下:

甲:80,72,85,67,50,76,95,49

乙:77,90,92,89,67,94

丙:99,87,95,93,88,78,85

现要求将每个班的成绩从高到低依次排列。

import java.util.Arrays;/*** 现有甲乙丙三个班级成绩统计如下:* 甲:80,72,85,67,50,76,95,49* 乙:77,90,92,89,67,94* 丙:99,87,95,93,88,78,85* 现要求将每个班的成绩从高到低依次排列。**/
public class ArraySort {public static void main(String[] args) {int[] arr1 = {80,72,85,67,50,76,95,49};int[] arr2 = {77,90,92,89,67,94};int[] arr3 = {99,87,95,93,88,78,85};//可以使用冒泡排序来对数组中的元素进行降序排列sortDesc(arr1);System.out.println(Arrays.toString(arr1));sortDesc(arr2);System.out.println(Arrays.toString(arr2));sortDesc(arr3);System.out.println(Arrays.toString(arr3));}public static void sortDesc(int[] arr){for(int i=0; i<arr.length; i++){for(int j=0; j<arr.length-i-1; j++){if(arr[j] < arr[j+1]){int temp = arr[j];arr[j] = arr[j+1];arr[j+1] = temp;}}}}
}

练习

使用方法来完成菜单数组的显示功能。

在这里插入图片描述

/*** 菜单类**/
public class Menu {public int order; //编号public String name; //名称public Menu(int order,String name){this.order = order;this.name = name;}public void show(){System.out.println(order + "." + name);}
}
public class MenuArray {public static void main(String[] args) {Menu[] mainMenus = {new Menu(1,"学生成绩管理"),new Menu(2,"学生选课管理"),new Menu(3,"退出系统"),};Menu[] secondMenus = {new Menu(1,"增加成绩"),new Menu(1,"修改成绩"),new Menu(1,"删除成绩"),new Menu(1,"查询成绩"),new Menu(1,"返回主菜单"),};showMenus(mainMenus); //显示主菜单showMenus(secondMenus); //显示第二菜单}public static void showMenus(Menu[] menus){for(int i=0; i<menus.length; i++){menus[i].show();}}
}

6.方法参数传递规则

方法传参

Primitive arguments, such as an int or a double, are passed into methods by value. This means that any changes to the values of the parameters exist only within the scope of the method. When the method returns, the parameters are gone and any changes to them are lost. 
基本数据类型的参数(例如int或double)按值传递给方法。这意味着当方法返回时,传入的引用仍然引用与以前相同的对象。但是,如果对象的字段的值具有适当的访问级别,则可以在方法中更改它们。
Reference data type parameters, such as objects, are also passed into methods by value. This means that when the method returns, the passed-in reference still references the same object as before. However, the values of the object's fields can be changed in the method, if they have the proper access level.
引用数据类型参数(例如对象)也按值传递到方法中。这意味着当方法返回时,传入的引用仍然引用与以前相同的对象。但是,如果对象的字段的值具有适当的访问级别,则可以在方法中更改它们。

基本数据类型传值案例

public class PassingPrimitive {public static void main(String[] args) {int a = 10;change(a);//调用方法时,实际上传递的是变量a的值的拷贝System.out.println(a);}public static void change(int number){number++;}
}

编译结果为:

在这里插入图片描述

思考:为什么基本数据类型a进入方法后值没有被修改?

这是因为基本数据类型传值时传递的是值的拷贝(或者理解为值的副本)

在这里插入图片描述

副本中的a值再怎么变化,和原来的a值没关系。

引用数据类型传值案例

/*** 计算机类**/
public class Computer {public String brand;//品牌public String type;//型号public double price;//价格public Computer(){}public Computer(String brand, String type, double price){this.brand = brand;this.type = type;this.price = price;}
}public class ComputerText {public static void main(String[] args){Computer c1 = new Computer();c1.brand = "联想";c1.type = "T430";c1.price = 5000;Computer c2 = new Computer();c2.brand = "联想";c2.type = "w530";c2.price = 6000;Computer c3 = new Computer();c3.brand = "联想";c3.type = "T450";c3.price = 7000;//这里传递的参数就是实际参数Computer c4 = new Computer("联想","T430",5000);updatComputer(c4);System.out.println(c4.price);Computer c5 = new Computer("联想","w530",6000);Computer c6 = new Computer("联想","T450",7000);}public static void updataComputer(Computer computer){computer.price = 10000;}
}

编译结果为:

在这里插入图片描述

思考:为什么引用数据类型进入方法后值就就行了修改?

这是因为引用数据类型传值时传递的是对象在堆内存上的空间地址(或者理解为值的副本)

在这里插入图片描述

第二节 方法重载(Overloa)

1.概念

在同一个类中,方法名相同参数列表不同的多个方法构成方法重载(只看方法名和参数列表)

2.示例

public class Calculator{public int sum(int a,int b){return a + b;}public int sum(int a,int b,int c){return a + b + c;}
}

3.误区

下面的方法是否属于方法重载?

在这里插入图片描述

不属于方法重载,因为方法名和参数列表都一样,在同一个类中,不可能出现这样的方法定义

在这里插入图片描述

不属于方法重载,因为方法名和参数列表都一样,在同一个类中,不可能出现这样的方法定义

在这里插入图片描述

属于方法重载,在同一个类中,方法名相同,参数列表不一样。

4.构造方法重载

构造方法也是方法,因此构造方法也可以重载。如果在一个类中出现了多个构造方法的定义,那么这些构造方法就形成构造方法重载。

在这里插入图片描述

this关键字可以调用构造方法,但是必须是这个构造方法中的第一条语句

在这里插入图片描述

第三节 面向对象和面向过程的区别

1.案例

级联菜单展示

在这里插入图片描述

2.代码实现

面向过程

import java.util.Scanner;/*** Procedure Oriented Program 面向过程编程**/
public class POP {public static void main(String[] args) {Scanner sc = new Scanner(System.in);while(true) {System.out.println("1.学生成绩管理");System.out.println("2.学生选课管理");System.out.println("3.退出系统");System.out.println("请选择菜单编号:");int number = sc.nextInt();if(number == 1){outer:while(true) {System.out.println("1.增加成绩");System.out.println("2.修改成绩");System.out.println("3.删除成绩");System.out.println("4.查询成绩");System.out.println("5.返回主菜单");System.out.println("请输入菜单编号:");int order = sc.nextInt();switch(order){case 1:System.out.println("你选择了增加成绩");break;case 2:System.out.println("你选择了修改成绩");break;case 3:System.out.println("你选择了删除成绩");break;case 4:System.out.println("你选择了查询成绩");break;case 5:break outer;}}} else if(number == 2){System.out.println("你选择了学生选课管理");} else {System.out.println("感谢使用XXX系统");break;}}}
}

面向对象

分析:

a.该过程涉及到的对象(事物)有两个:用户和菜单

b.用户拥有执行增删改查的动作

/*** 菜单类**/
public class Menu {public int order; //编号public String name; //名称public Menu(int order,String name){this.order = order;this.name = name;}public void show(){System.out.println(order + "." + name);}
}
/**
*  用户类
*
*/
public class User {public void addScore(){System.out.println("你选择了增加成绩");}public void deleteScore(){System.out.println("你选择了删除成绩");}public void updateScore(){System.out.println("你选择了修改成绩");}public void searchScore(){System.out.println("你选择了查询成绩");}
}
import java.util.Scanner;/*** Object Oriented Programming 面向对象编程**/
public class OOP {public static Menu[] mainMenus = {new Menu(1,"学生成绩管理"),new Menu(2,"学生选课管理"),new Menu(3,"退出系统"),};public static Menu[] secondMenus = {new Menu(1,"增加成绩"),new Menu(2,"修改成绩"),new Menu(3,"删除成绩"),new Menu(4,"查询成绩"),new Menu(5,"返回主菜单"),};public static Scanner sc = new Scanner(System.in);public static User user = new User();public static void main(String[] args) {gotoMain();}//去主菜单public static void gotoMain(){showMenus(mainMenus);//显示主菜单int number = sc.nextInt();if(number == 1){gotoSecond();} else if(number == 2){System.out.println("你选择了学生选课管理");gotoMain();//去主菜单} else {System.out.println("感谢使用XXX系统");}}//去二级菜单public static void gotoSecond(){showMenus(secondMenus);//显示二级菜单int order = sc.nextInt();switch (order){case 1:user.addScore();//用户增加成绩gotoSecond();break;case 2:user.updateScore();//用户修改成绩gotoSecond();break;case 3:user.deleteScore();//用户删除成绩gotoSecond();break;case 4:user.searchScore();//用户查询成绩gotoSecond();break;case 5:gotoMain();break;}}public static void showMenus(Menu[] menus){for(int i=0; i<menus.length; i++){menus[i].show();}System.out.println("请选择菜单编号:");}
}

对比

r == 1){
gotoSecond();
} else if(number == 2){
System.out.println(“你选择了学生选课管理”);
gotoMain();//去主菜单
} else {
System.out.println(“感谢使用XXX系统”);
}
}

//去二级菜单
public static void gotoSecond(){showMenus(secondMenus);//显示二级菜单int order = sc.nextInt();switch (order){case 1:user.addScore();//用户增加成绩gotoSecond();break;case 2:user.updateScore();//用户修改成绩gotoSecond();break;case 3:user.deleteScore();//用户删除成绩gotoSecond();break;case 4:user.searchScore();//用户查询成绩gotoSecond();break;case 5:gotoMain();break;}
}public static void showMenus(Menu[] menus){for(int i=0; i<menus.length; i++){menus[i].show();}System.out.println("请选择菜单编号:");
}

}


<font color = "blue">对比</font>面向过程侧重点在过程的实现上,面向对象侧重点在对象上,需要利用对象的行为来完成过程的组装。

相关文章:

新手入门Java 方法带参,方法重载及面向对象和面向过程的区别介绍

第二章 方法带参 课前回顾 1.描述类和对象的关系 类是一组对象的共有特征和行为的描述。对象是类的其中一个具体的成员。 2.如何创建对象 类名 对象名 new 类名();3.如何定义和调用方法 public void 方法名(){}对象名.方法名();4.成员变量和局部变量的区别 成员变量有初…...

使用Sqoop将Hive数据导出到TiDB

关系型数据库与大数据平台之间的数据传输之前写过一些 使用Sqoop将数据在HDFS与MySQL互导 使用Sqoop将SQL Server视图中数据导入Hive 使用DataX将Hive与MySQL中的表互导 使用Sqoop将Hive数据导出到TiDB虽然没写过&#xff0c;但网上一堆写的&#xff0c;那为什么我要专门写一下…...

互联网上门洗衣洗鞋工厂系统搭建;

随着移动互联网的普及&#xff0c;人们越来越依赖手机应用程序来解决生活中的各种问题。通过手机预约服务、购买商品、获取信息已经成为一种生活习惯。因此&#xff0c;开发一款上门洗鞋小程序&#xff0c;可以满足消费者对于方便、快捷、专业的洗鞋服务的需求&#xff0c;同时…...

Redis面试题12

Redis 的主从复制是什么&#xff1f; Redis 的主从复制是一种数据备份和高可用性机制&#xff0c;通过将一个 Redis 服务器的数据复制到其他 Redis 从服务器上来实现数据的冗余备份和读写分离。 主从复制的工作原理如下&#xff1a; 配置主服务器并开启主从复制功能。从服务器…...

el-tree多个树进行节点同步联动(完整版)

2024.1.11今天我学习了如何对多个el-tree树进行相同节点的联动效果&#xff0c;如图&#xff1a; 这边有两棵树&#xff0c;我们发现第一个树和第二个树之间会有重复的指标&#xff0c;当我们选中第一个树的指标&#xff0c;我们希望第二个树如果也有重复的指标也能进行勾选上&…...

python两个字典合并,两个list合并

1.两个字典&#xff1a; a{‘a’:1,‘b’:2,‘c’:3} b {‘aa’:11,‘bb’:22,‘cc’:33} 合并1&#xff1a;dict(a, **b) 结果&#xff1a;{‘a’: 1,‘aa’: 11,‘c’: 3,‘b’: 2,‘bb’: 22,‘cc’: 33} 合并2&#xff1a;dict(a.items()b.items()) 结果&#xff1a;{‘…...

搜维尔科技:【简报】元宇宙数字人赛道,《全息影像技术应用》!

期待着看展的主角来到今天要参观的全息影像展&#xff0c;平时就喜欢看展的她对于所谓的全息影像非常好奇&#xff0c;于是她带着期待的心情进入展内。进入展内的主角看到的是与之前完全不同的画展&#xff0c;每幅画看起来就像真的一样&#xff0c;充满好奇的她在展览的各处游…...

SparkSQL和Hive语法差异

SparkSQL和Hive语法差异 1、仅支持Hive SparkSQL关联条件on不支持函数rand()创建零时表时&#xff0c;Spark不支持直接赋值nullSpark无法读取字段类型为void的表SparkSQL中如果表达式没有指定别名&#xff0c;SparkSQL会将整个表达式作为别名&#xff0c;如果表达式中包含特殊…...

XCODE IOS 静态链接库替换升级

XCODE 版本15.2. 一个很久需求没更新的IOS 应用&#xff0c;近来有新需求要开发。 拉下代码运行&#xff0c;出现了个BAD_ACCESS错误。出错的位置位于一个调用的第三方的.a静态库内部。因为调用代码并没有修改&#xff0c;很容易想到可能XCODE相关升级&#xff0c;导致的问题。…...

API设计:从基础到优秀实践

在这次深入探讨中&#xff0c;我们将深入了解API设计&#xff0c;从基础知识开始&#xff0c;逐步进阶到定义出色API的最佳实践。 作为开发者&#xff0c;你可能对许多这些概念很熟悉&#xff0c;但我将提供详细的解释&#xff0c;以加深你的理解。 API设计&#xff1a;电子商…...

路由的安装顺序

安装前端路由的顺序通常如下&#xff1a; 安装前端框架&#xff1a;选择并安装适合你的项目的前端框架&#xff0c;如React、Vue或Angular等。 创建路由配置文件&#xff1a;在项目根目录下创建一个路由配置文件&#xff0c;比如router.js或routes.js等&#xff0c;用于定义路…...

华为OD机试真题-围棋的气--Java-OD统一考试(C卷)

题目描述: 围棋棋盘由纵横各19条线垂直相交组成,棋盘上一共19x19=361个交点,对弈双方一方执白棋,一方执黑棋,落子时只能将棋子置于交点上。 “气”是围棋中很重要的一个概念,某个棋子有几口气,是指其上下左右方向四个相邻的交叉点中,有几个交叉点没有棋子,由此可知: …...

CANFD数据记录仪在新能源汽车复杂路测下的应用

CANFD数据记录仪在新能源汽车复杂路测下的应用 汽车制造商在生产预批量阶段的耐久性测试中,为了检测潜在故障,必须让车辆在严酷的路况和环境下接受测试。为确保能回溯故障发生的现场情况,我们需要对测试数据精准记录与储存。这些数据是新车型优化迭代的关键,也是确保产品质量的…...

java: 5-6 break

文章目录 1. break1.1 介绍1.2 语法和流程图1.3 入门练习1.4 细节说明1.5 练习 【老韩视频p137-】 1. break 看个需求&#xff1a;随机生成 1-100 的一个数&#xff0c;直到生成了 97 这个数&#xff0c;看看你一共用了几次? 【思路分析:循环&#xff0c;但是循环的次数不知道…...

如何使用Imagewheel搭建一个简单的的私人图床无公网ip也能访问

文章目录 1.前言2. Imagewheel网站搭建2.1. Imagewheel下载和安装2.2. Imagewheel网页测试2.3.cpolar的安装和注册 3.本地网页发布3.1.Cpolar临时数据隧道3.2.Cpolar稳定隧道&#xff08;云端设置&#xff09;3.3.Cpolar稳定隧道&#xff08;本地设置&#xff09; 4.公网访问测…...

响应式编程Reactor API大全(上)

Reactor 是一个基于响应式编程的库&#xff0c;主要用于构建异步和事件驱动的应用程序。Reactor 提供了丰富的 API&#xff0c;包括创建、转换、过滤、组合等操作符&#xff0c;用于处理异步数据流。以下是一些 Reactor 的主要 API 示例&#xff1a; pom依赖 <dependencyMan…...

vue3自定义指令

一个自定义指令由一个包含类似组件生命周期钩子的对象来定义。钩子函数会接收到指令所绑定元素作为其参数。 页面内创建自定义指令 下面是一个自定义指令的例子&#xff0c;当一个 input 元素被 Vue 插入到 DOM 中后&#xff0c;它会被自动聚焦&#xff1a; <script setu…...

ECharts 多季度连续显示到一个图中。

效果图 二.相关option 以下option可以复制到 echarts的编辑器 进行查看修改 const site test1; const site2 test2;const qtrlyOption function (data: any, titleText: string): any {//获取最大值 。最大最小值的目的是&#xff1a;使左右里边的所有bar使用同一个指标let …...

【Microsoft Copilot】手机端发布 ——GPT-4, DALL-E3 免费用

Microsoft Copilot 关于Microsoft CopilotMicrosoft Copilot 的特点1. 可以在手机端使用&#xff1a;2. 可以免费使用GPT-4。3. 可以无限制地使用GPT-4。4. 可以使用DALL-E3生成图片。5. 搜索功能6. 图像识别 Microsoft Copilot的缺点和注意事项1. 非常容易报错2. 不支持长篇聊…...

[蓝桥杯 2013 省 AB] 错误票据

题目背景 某涉密单位下发了某种票据&#xff0c;并要在年终全部收回。 题目描述 每张票据有唯一的 ID 号&#xff0c;全年所有票据的 ID 号是连续的&#xff0c;但 ID 的开始数码是随机选定的。因为工作人员疏忽&#xff0c;在录入 ID 号的时候发生了一处错误&#xff0c;造…...

IDEA GitHub令牌原理(Personal Access Token)

1.IDEA的add github account 是什么原理&#xff1f; 在IntelliJ IDEA中添加GitHub账户&#xff0c;主要是为了让IDEA能够与GitHub进行交互&#xff0c;如克隆GitHub上的仓库&#xff0c;提交代码到GitHub等。其基本原理如下&#xff1a; 用户在IDEA中输入GitHub的用户名和密…...

[开发语言][python][c++]:C++中的this指针和Python中的Self -- 26岁生日

C中的this指针和Python中的Self 1. python中的Self2. C中的this指针3. C中的this指针和Python中self的异同点&#xff1a; 以朋友的新岁祝福开篇&#xff0c;祝笔者也祝大家☺️&#xff1a; 一岁一礼 一寸欢喜且喜且乐 且以永日​ From VardoZ癸卯年十一月廿六(兔年)之…...

Android Traceview 定位卡顿问题

Traceview 是一个 Android 性能分析工具&#xff0c;用于时间性能分析&#xff0c;主要帮助开发者了解应用程序中各个方法的执行时间和调用关系。Traceview 可以通过图形化界面查看应用程序的代码执行细节&#xff0c;包括每个方法的调用次数、方法调用的时间消耗、方法调用堆栈…...

第三方 Cookie 被禁用?企业该如何实现用户精准运营和管理?

从 1 月 4 日开始&#xff0c;谷歌 Chrome 浏览器将逐步禁用第三方 Cookie 。作为全球最大的浏览器之一&#xff0c;Chrome 的这一动作无疑将引发行业内的重大变革。一直以来&#xff0c;第三方 Cookie 都是网络营销和广告的重要工具。然而&#xff0c;随着人们对隐私保护的日益…...

Autosar PNC网络管理配置(2)-基于ETAS软件

文章目录 BswM初始化PNC对PDU的控制BswMModeRequestPortBswMModeConditionBswMLogicalExpressionBswMRuleBswMActionListEcuMEcuMWakeupSourceEcuMShutdownCauseEcuMRbAlSwitchOffCalloutEcuMRbOnGoOff...

【SpringMVC快速使用】1.@RestController @RequestMapping 2.logback的使用

背景&#xff1a;为何从这个最简单的 例子写起呢&#xff1f; 那是因为我们的管理后台之类的都是别人写的&#xff0c;我也听说了大家说&#xff1a;只用Post请求就足够了&#xff0c;但是却发现&#xff0c;在浏览器中测试时&#xff0c;默认是GET请求&#xff0c;如果直接写…...

C2593 operator << 不明确

错误 C2593 “operator <<” 不明确&#xff0c;通常出现在C代码中&#xff0c;当你尝试使用<<运算符&#xff08;通常用于输出或位移运算&#xff09;时&#xff0c;编译器无法确定使用哪个重载版本的运算符。这个错误可能由几个原因引起&#xff1a; 多个重载冲突…...

vue:使用【3.0】:条件模块

一、条件层级效果图 二、代码 <template><ContentWrap><!-- 添加条件分支:level1 --><div class"btnBox" v-if"isEdit"><el-button type"primary" click"add">添加条件分支</el-button></div…...

Kafka与RabbitMQ的区别

消息队列介绍 消息队列&#xff08;Message Queue&#xff09;是一种在分布式系统中进行异步通信的机制。它允许一个或多个生产者在发送消息时暂时将消息存储在队列中&#xff0c;然后由一个或多个消费者按顺序读取并处理这些消息。 消息队列具有以下特点&#xff1a; 异步通…...

C++力扣题目538--把二叉搜索树转换为累加树

给出二叉 搜索 树的根节点&#xff0c;该树的节点值各不相同&#xff0c;请你将其转换为累加树&#xff08;Greater Sum Tree&#xff09;&#xff0c;使每个节点 node 的新值等于原树中大于或等于 node.val 的值之和。 提醒一下&#xff0c;二叉搜索树满足下列约束条件&#…...