Java番外篇2——jdk8新特性

Java番外篇2——jdk8新特性

1、Lambda

1.1、无参无返回值

public class Test {interface Print{void print();}public static void main(String[] args) {
//        Print print=new Print() {
//            @Override
//            public void print() {
//                System.out.println("hello word!");
//            }
//        };Print print=()-> System.out.println("hello word!");print.print();}
}

1.2、一个参数无返回值

public class Test {interface Print{void print(String str);}public static void main(String[] args) {
//        Print print=new Print() {
//            @Override
//            public void print(String str) {
//                System.out.println("hello word! "+str);
//            }
//        };Print print=str-> System.out.println("hello word! "+str);print.print("ruoye");}
}

1.3、多个参数无返回值

public class Test {interface Print{void print(String str,String str1);}public static void main(String[] args) {
//        Print print=new Print() {
//            @Override
//            public void print(String str,String str1); {
//                System.out.println("hello word! "+str+str1);
//            }
//        };Print print=(str,str1)-> System.out.println("hello word! "+str+str1);print.print("ruoye","yoya");}
}

1.4、多个参数有返回值(单句)

public class Test {interface Print{String print(String str,String str1);}public static void main(String[] args) {Print print=(str,str1)-> str+str1;System.out.println(print.print("ruoye", "yoya"));}
}

1.4、多个参数有返回值(多句)

public class Test {interface Print{String print(String str,String str1);}public static void main(String[] args) {Print print=(str,str1)-> {System.out.println("hello word! "+str+str1);return str+str1;};System.out.println(print.print("ruoye", "yoya"));}
}

2、函数式接口(@FunctionalInterface)

  • 该注解只能标记在"有且仅有一个抽象方法"的接口上
  • JDK8接口中可以定义静态方法和默认方法(方法默认实现default),都不算是抽象方法
public class Test {@FunctionalInterfaceinterface Print{String print(String str,String str1);}public static void main(String[] args) {Print print=(str,str1)-> {System.out.println("hello word! "+str+str1);return str+str1;};System.out.println(print.print("ruoye", "yoya"));}
}

3、接口调整

方便接口扩展

jdk8之前接口只能有静态常量和抽象方法

jdk8后接口可以有默认方法和静态方法

public interface Print{public static void aaa(){System.out.println("aaa");}public default void bbb(){System.out.println("bbb");}String print(String str,String str1);
}

4、方法引用

::

5、Stream(流水线)

  • 集合遍历有弊端
  • 筛选
  • 切片
  • 映射
  • 查找
  • 去重
  • 统计
  • 匹配
  • 归约

特性

  • Stream只能操作一次

  • Stream方法返回的是新的流

  • Stream不调用终结方法,中间的操作不会执行

5.1、Stream的获取

public class Test {public static void main(String[] args) {//集合List<String> strings = Arrays.asList("zhangsan", "lisi", "wangwu", "zhaoliu");Stream<String> stream = strings.stream();//数组String[] strings1={"zhangsan", "lisi", "wangwu", "zhaoliu"};Stream<String> stream1 = Stream.of(strings1);//map可以通过获取键集合,值集合,从而获得流}
}

5.2、常用方法

方法声明功能介绍返回值方法类型
count统计个数long终结
forEach逐一处理void终结
filter过滤Stream函数拼接
limit取用前几个Stream函数拼接
skip跳过前几个Stream函数拼接
map映射Stream函数拼接
concat组合Stream函数拼接

5.3、forEach

public class Test {public static void main(String[] args) {List<String> strings = Arrays.asList("zhangsan", "lisi", "wangwu", "zhaoliu");strings.stream().forEach(System.out::println);}
}

5.4、count

public class Test {public static void main(String[] args) {List<String> strings = Arrays.asList("zhangsan", "lisi", "wangwu", "zhaoliu");System.out.println(strings.stream().count());}
}

5.5、filter

public class Test {public static void main(String[] args) {List<String> strings = Arrays.asList("zhangsan", "lisi", "wangwu", "zhaoliu");strings.stream().filter(s -> s.startsWith("z")).forEach(System.out::println);}
}

5.6、limit

public class Test {public static void main(String[] args) {List<String> strings = Arrays.asList("zhangsan", "lisi", "wangwu", "zhaoliu");strings.stream().limit(1).forEach(System.out::println);}
}

5.7、skip

public class Test {public static void main(String[] args) {List<String> strings = Arrays.asList("zhangsan", "lisi", "wangwu", "zhaoliu");strings.stream().skip(1).forEach(System.out::println);}
}

5.8、map

完成数据转换、处理

public class Test {public static void main(String[] args) {List<String> strings = Arrays.asList("zhangsan", "lisi", "wangwu", "zhaoliu");strings.stream().map(s->s+="yoya").forEach(System.out::println);}
}

5.9、sorted

public class Test {public static void main(String[] args) {List<String> strings = Arrays.asList("zhangsan", "lisi", "wangwu", "zhaoliu");strings.stream().sorted().forEach(System.out::println);}
}

5.10、distinct

Stream流中的distinct方法对于基本数据类型是可以直接出重的,但是对于自定义类型,需要重写hashCode和equals方法来移除重复元素

public class Test {public static void main(String[] args) {List<String> strings = Arrays.asList("zhangsan", "lisi", "wangwu", "zhaoliu","zhangsan");strings.stream().distinct().forEach(System.out::println);}
}

5.11、match

public class Test {public static void main(String[] args) {List<String> strings = Arrays.asList("zhangsan", "lisi", "wangwu", "zhaoliu","zhangsan");System.out.println(strings.stream().anyMatch(s -> s.startsWith("z")));}
}
public class Test {public static void main(String[] args) {List<String> strings = Arrays.asList("zhangsan", "lisi", "wangwu", "zhaoliu","zhangsan");System.out.println(strings.stream().allMatch(s -> s.startsWith("z")));}
}
public class Test {public static void main(String[] args) {List<String> strings = Arrays.asList("zhangsan", "lisi", "wangwu", "zhaoliu","zhangsan");System.out.println(strings.stream().noneMatch(s -> s.startsWith("z")));}
}

5.12、find

findfirst返回第一个元素

findany返回随机一个元素

public class Test {public static void main(String[] args) {List<String> strings = Arrays.asList("zhangsan", "lisi", "wangwu", "zhaoliu","zhangsan");Optional<String> z = strings.stream().filter(s -> s.startsWith("z")).findAny();System.out.println(z.get());}
}

5.13、max,min

public class Test {public static void main(String[] args) {List<String> strings = Arrays.asList("zhangsan", "lisi", "wangwu", "zhaoliu","zhangsan");Optional<String> max = strings.stream().max((s1, s2) -> {return s1.compareTo(s2);});System.out.println(max.get());}
}
public class Test {public static void main(String[] args) {List<String> strings = Arrays.asList("zhangsan", "lisi", "wangwu", "zhaoliu","zhangsan");Optional<String> max = strings.stream().min((s1, s2) -> {return s1.compareTo(s2);});System.out.println(max.get());}
}

5.14、reduce

归约

public class Test {public static void main(String[] args) {Integer reduce = Stream.of(1, 2, 3, 4, 5).reduce(0, (a, b) -> {return a + b;});System.out.println(reduce);}
}

5.15、mapToInt

转为int

public class Test {public static void main(String[] args) {Integer[] integers={1, 2, 3, 4, 5};Stream.of(integers).mapToInt(Integer::intValue).forEach(System.out::println);}
}

5.16、concat

合并流

public class Test {public static void main(String[] args) {Integer[] integers={1, 2, 3, 4, 5};Integer[] integers1={6,7,8,9,10};Stream<Integer> concat = Stream.concat(Stream.of(integers), Stream.of(integers1));concat.mapToInt(Integer::intValue).forEach(System.out::println);}
}

5.17、结果收集

public class Test {public static void main(String[] args) {Integer[] integers={1, 2, 3, 4, 5};Integer[] integers1={6,7,8,9,10};Stream<Integer> concat = Stream.concat(Stream.of(integers), Stream.of(integers1));List<Integer> collect = concat.collect(Collectors.toList());System.out.println(collect);}
}
public class Test {public static void main(String[] args) {Integer[] integers={1, 2, 3, 4, 5};Integer[] integers1={6,7,8,9,10};Stream<Integer> concat = Stream.concat(Stream.of(integers), Stream.of(integers1));List<Integer> collect = concat.collect(Collectors.toCollection(ArrayList::new));System.out.println(collect);}
}
public class Test {public static void main(String[] args) {Integer[] integers={1, 2, 3, 4, 5};Integer[] integers1={6,7,8,9,10};Stream<Integer> concat = Stream.concat(Stream.of(integers), Stream.of(integers1));Integer[] integers2 = concat.toArray(Integer[]::new);System.out.println(Arrays.toString(integers2));}
}

5.19、聚合

public class Test {public static void main(String[] args) {Person person0 = new Person(1, "zhangsan", true);Person person1 = new Person(2, "lisi", true);Person person2 = new Person(3, "wangwu", false);Person person3 = new Person(4, "zhaoliu", true);Person person4 = new Person(5, "qianqi", true);Stream<Person> person = Stream.of(person0, person1, person2, person3, person4);Optional<Person> collect = person.collect(Collectors.maxBy((p1, p2) -> {return p1.getId() - p2.getId();}));System.out.println(collect.get());}
}
public class Test {public static void main(String[] args) {Person person0 = new Person(1, "zhangsan", true);Person person1 = new Person(2, "lisi", true);Person person2 = new Person(3, "wangwu", false);Person person3 = new Person(4, "zhaoliu", true);Person person4 = new Person(5, "qianqi", true);Stream<Person> person = Stream.of(person0, person1, person2, person3, person4);Integer collect = person.collect(Collectors.summingInt(p -> p.getId()));System.out.println(collect);}
}
public class Test {public static void main(String[] args) {Person person0 = new Person(1, "zhangsan", true);Person person1 = new Person(2, "lisi", true);Person person2 = new Person(3, "wangwu", false);Person person3 = new Person(4, "zhaoliu", true);Person person4 = new Person(5, "qianqi", true);Stream<Person> person = Stream.of(person0, person1, person2, person3, person4);Double collect = person.collect(Collectors.averagingInt(Person::getId));System.out.println(collect);}
}
public class Test {public static void main(String[] args) {Person person0 = new Person(1, "zhangsan", true);Person person1 = new Person(2, "lisi", true);Person person2 = new Person(3, "wangwu", false);Person person3 = new Person(4, "zhaoliu", true);Person person4 = new Person(5, "qianqi", true);Stream<Person> person = Stream.of(person0, person1, person2, person3, person4);Long collect = person.collect(Collectors.counting());System.out.println(collect);}
}

5.20、分组

public class Test {public static void main(String[] args) {Person person0 = new Person(1, "zhangsan", true);Person person1 = new Person(2, "lisi", true);Person person2 = new Person(3, "zhangsan", false);Person person3 = new Person(4, "lisi", true);Person person4 = new Person(5, "zhangsan", true);
//        Stream<Person> person = Stream.of(person0, person1, person2, person3, person4);
//        Map<String, List<Person>> collect = person
//                .collect(Collectors.groupingBy(person5 -> person5.getName()));
//        System.out.println(collect);//        Stream<Person> person = Stream.of(person0, person1, person2, person3, person4);
//        Map<String, List<Person>> collect = person
//                .collect(Collectors.groupingBy(person5 -> person5.isGender()?"男":"女"));
//        System.out.println(collect);Stream<Person> person = Stream.of(person0, person1, person2, person3, person4);Map<String, Map<String, List<Person>>> collect = person.collect(Collectors.groupingBy(person5 -> person5.getName(), Collectors.groupingBy(person5 -> person5.isGender() ? "男" : "女")));System.out.println(collect);}
}

5.21、分区

public class Test {public static void main(String[] args) {Person person0 = new Person(1, "zhangsan", true);Person person1 = new Person(2, "lisi", true);Person person2 = new Person(3, "zhangsan", false);Person person3 = new Person(4, "lisi", true);Person person4 = new Person(5, "zhangsan", true);Stream<Person> person = Stream.of(person0, person1, person2, person3, person4);Map<Boolean, List<Person>> collect = person.collect(Collectors.partitioningBy(person5 -> person5.isGender()));System.out.println(collect);}
}

5.22、joining

public class Test {public static void main(String[] args) {Person person0 = new Person(1, "zhangsan", true);Person person1 = new Person(2, "lisi", true);Person person2 = new Person(3, "zhangsan", false);Person person3 = new Person(4, "lisi", true);Person person4 = new Person(5, "zhangsan", true);//        Stream<Person> person = Stream.of(person0, person1, person2, person3, person4);
//        String collect = person
//                .map(person5 -> person5.getName())
//                .collect(Collectors.joining());
//        System.out.println(collect);
//
//        Stream<Person> person = Stream.of(person0, person1, person2, person3, person4);
//        String collect = person
//                .map(person5 -> person5.getName())
//                .collect(Collectors.joining("_"));
//        System.out.println(collect);Stream<Person> person = Stream.of(person0, person1, person2, person3, person4);String collect = person.map(person5 -> person5.getName()).collect(Collectors.joining("_","###","$$$"));System.out.println(collect);}
}

5.23、并行流

public class Test {public static void main(String[] args) {Person person0 = new Person(1, "zhangsan", true);Person person1 = new Person(2, "lisi", true);Person person2 = new Person(3, "zhangsan", false);Person person3 = new Person(4, "lisi", true);Person person4 = new Person(5, "zhangsan", true);Stream<Person> person01 = Stream.of(person0, person1, person2, person3, person4).parallel();person01.map(s->{System.out.println(Thread.currentThread()+"==="+s);return s;}).forEach(System.out::println);}
}

并行流出现问题可尝试使用同步代码块

6、日期

  • 设计不合理,在java.util和java.sql的包中都有日期类,java.util.Date同时包含日期和时间的,而 java.sql.Date仅仅包含日期,此外用于格式化和解析的类在java.text包下
  • 非线程安全,java.util.Date是非线程安全的,所有的日期类都是可变的,这是java日期类最大的问 题之一
  • 时区处理麻烦,日期类并不提供国际化,没有时区支持

JDK 8中增加了一套全新的日期时间API,这套API设计合理,是线程安全(每次都返回新对象)的,新的日期及时间API位于java.time包

  • LocalDate :表示日期,包含年月日,格式为 2019-10-16
  • LocalTime :表示时间,包含时分秒,格式为 16:38:54.158549300
  • LocalDateTime :表示日期时间,包含年月日,时分秒,格式为 2018-09-06T15:33:56.750
  • DateTimeFormatter :日期时间格式化类
  • Instant:时间戳,表示一个特定的时间瞬间
  • Duration:用于计算2个时间(LocalTime,时分秒)的距离
  • Period:用于计算2个日期(LocalDate,年月日)的距离
  • ZonedDateTime :包含时区的时间

6.1、LocalDate

public class Test {public static void main(String[] args) {//指定日期创建LocalDate localDate=LocalDate.of(2020,10,19);System.out.println(localDate);//当前日期创建System.out.println(LocalDate.now());//更改日期LocalDate localDate1 = localDate.withMonth(11);System.out.println(localDate1);//日期增减(plus,minus)LocalDate localDate2 = localDate1.plusDays(1);System.out.println(localDate2);//日期比较System.out.println(localDate.isAfter(localDate1));System.out.println(localDate.isBefore(localDate1));}
}

6.2、LocalTime

public class Test {public static void main(String[] args) {//指定时间创建LocalTime localTime=LocalTime.of(10,19,0,123);System.out.println(localTime);//当前时间创建System.out.println(LocalTime.now());//时间更改LocalTime localTime1 = localTime.withHour(11);System.out.println(localTime1);//时间增减(plus,minus)LocalTime localTime2 = localTime1.plusHours(1);System.out.println(localTime2);//时间比较同上}
}

6.3、LocalDateTime

public class Test {public static void main(String[] args) {LocalDate now = LocalDate.now();LocalTime now1 = LocalTime.now();LocalDateTime now2 = LocalDateTime.now();System.out.println(LocalDateTime.of(now,now1));System.out.println(now2);//同样有设置、增减、比较}
}

6.4、DateTimeFormatter

日期时间格式化与解析

public class Test {public static void main(String[] args) {LocalDateTime now = LocalDateTime.now();DateTimeFormatter dateTimeFormatter=DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");System.out.println(dateTimeFormatter.format(now));String str="2021-07-16 11:03:00";LocalDateTime parse = LocalDateTime.parse(str, dateTimeFormatter);System.out.println(parse);}
}

6.5、Instant

public class Test {public static void main(String[] args) {Instant instant=Instant.now();System.out.println(instant.getNano());}
}

6.6、Duration、Period

Duration:时间差

Period:日期差

public class Test {public static void main(String[] args) {Duration duration = Duration.between(LocalTime.now(), LocalTime.of(12, 0, 0, 0));System.out.println(duration.toHours());System.out.println(duration.toMinutes());System.out.println(duration.toMillis());}
}
public class Test {public static void main(String[] args) {Period period = Period.between(LocalDate.now(), LocalDate.of(2022, 5, 2));System.out.println(period.getDays());System.out.println(period.getMonths());System.out.println(period.getYears());}
}

6.7、时区

public class Test {public static void main(String[] args) {//所有时区for (String availableZoneId : ZoneId.getAvailableZoneIds()) {System.out.println(availableZoneId);}//获取标准时间ZonedDateTime zonedDateTime=ZonedDateTime.now(Clock.systemUTC());System.out.println(zonedDateTime);//获取默认时区时间ZonedDateTime zonedDateTime1=ZonedDateTime.now();System.out.println(zonedDateTime1);//获取指定时区世家ZonedDateTime zonedDateTime2=ZonedDateTime.now(ZoneId.of("America/Cuiaba"));System.out.println(zonedDateTime2);}
}

7、@Repeatable

允许重复注解

8、@Target属性

ElementType.TYPE_PARAMETER:允许注解写在声明语句中

ElementType.TYPE_USE:任何定义的地方都可以用

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/557505.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

linux同花顺乱码,打开同花顺软件全是问号

官方答案&#xff1a;字体库字体乱码【原因分析】&#xff1a;系统字体缺失&#xff0c;损坏。【解决方案】方案一&#xff1a;使用360电脑门诊进行修复1.打开【360安全卫士】—【电脑专家】搜索乱码&#xff0c;然后会弹出如下六个解决方案&#xff0c;根据当前计算机的故障现…

Java番外篇3——线程池

Java番外篇3——线程池 1、多线程产生的问题 多次创建并销毁线程。而创建并销毁线程的过程势必会消耗内存 2、线程池 降低系统资源消耗&#xff0c;通过重用已存在的线程&#xff0c;降低线程创建和销毁造成的消耗提高系统响应速度&#xff0c;当有任务到达时&#xff0c;通…

嵌入式linux组件,嵌入式Linux系统的几大组件!

原标题&#xff1a;嵌入式Linux系统的几大组件&#xff01;本文概述了Linux系统的几大组件&#xff0c;描述了这些组件之间的关系。文章解释了术语&#xff0c;并描述看似很基础的细节。每个Linux系统都有许多主要组件。其中一个组件(引导加载程序)从技术上讲是Linux之外的&…

linux iptables找不到,centos /etc/sysconfig/下找不到iptables文件解决方法

本想做些防火墙策略。防火墙策略都是写在/etc/sysconfig/iptables文件里面的。可我发现我也没有这个文件。[rootxiaohuai /]# cd /etc/sysconfig/[rootxiaohuai sysconfig]# lsatd firstboot irqbalance network-scripts rhn sysstatauditd grub kdump ntpd rngd sysstat.iocon…

Java番外篇4——BigInteger与BigDecimal

Java番外篇4——BigInteger与BigDecimal 为了解决大数运算的问题 操作整型&#xff1a;BigInteger操作小数&#xff1a;BigDecimal 1、BigInteger 方法声明功能介绍public BigInteger abs()返回大整数的绝对值public BigInteger add(BigInteger val)返回两个大整数的和publ…

linux cd 命令案例,15个关于Linux的‘cd’命令的练习例子

命令名称&#xff1a;cd代表&#xff1a;切换目录使用平台&#xff1a;所有Linux发行版本执行方式&#xff1a;命令行权限&#xff1a;访问自己的目录或者其余指定目录级别&#xff1a;基础/初学者1.从当前目录切换到/usr/local avitecmint:~$ cd /usr/local avitecmint:/usr/l…

c语言字符串strchr,Strchr()C语言字符串处理功能

strchr()函数不如strcpy()&#xff0c;strcat()&#xff0c;strcmp()&#xff0c;strupr()&#xff0c;strlwr()&#xff0c;strlen()直观c strchr函数&#xff0c;因此需要代码理解:代码来自C语言开发入门和项目实战书:#include#includeint main(){字符字符串[50];char * str&…

Java数据库篇1——数据库配置

Java数据库篇1——数据库配置 1、数据库 数据库(DataBase) 就是存储和管理数据的仓库本质是一个文件系统, 还是以文件的方式,将数据保存在电脑上 2、数据库的优点 存储方式优点缺点内存速度快不能够永久保存,数据是临时状态的文件数据是可以永久保存的使用IO流操作文件, 不…

C语言中输入123求位权,数反转 - it610.com

32位系统c语言中&#xff1a;char取值范围:-128~127unsigned char取值范围:0~255int取值范围:-2147483648~2147483647unsigned int取值范围:0~429496729564位系统下C语言中int还是占4字节&#xff0c;32位&#xff0c;与32位系统中没有区别64位系统下&#xff0c;采用64位编译器…

Java数据库篇2——数据库基本操作

Java数据库篇2——数据库基本操作 1、启动、停止、服务 net start mysqlnet stop mysql2、登入登出 本地 Mysql -u用户名 -p密码Mysql -u用户名 -p回车 密码远程 Mysql -hIP地址 -u用户名 -p密码Mysql -hIP地址 -u用户名 -p回车 密码退出 Quit Exit

c语言加密shell脚本,shell脚本加密

如何保护自己编写的shell程序要保护自己编写的shell脚本程序&#xff0c;方法有很多&#xff0c;最简单的方法有两种&#xff1a;1、加密 2、设定过期时间&#xff0c;下面以shc工具为例说明&#xff1a;一、下载安装shc工具shc是一个加密shell脚本的工具.它的作用是把shell脚本…

Java数据库篇3——SQL

Java数据库篇3——SQL 结构化查询语言(Structured Query Language)简称SQL&#xff0c;是一种特殊目的的编程语言&#xff0c;是一种数据库 查询和程序设计语言&#xff0c;用于存取数据以及查询、更新和管理关系数据库系统 1、SQL分类 分类说明数据定义语言简称DDL(Data De…

c语言分配飞机10个座位,leetcode1227(飞机座位分配)--C语言实现

对于第一个乘客来说 他有三种选择坐在正确的(自己的位置), 那么后面的乘客都不会乱&#xff0c;所以第n个乘客可以坐到自己的位置, 1/n * 1.坐在第n个乘客的位置&#xff0c;那么第n个乘客肯定无法坐到自己的位置, 1/n * 0.坐在[1,n-1]之间的某个位置K.对于第K个乘客而言&#…

Java数据库篇4——表的约束

Java数据库篇4——表的约束 1、非空约束 字段不允许为空 #创建表的时候添加 Create table 表名(列1 数据类型 not null&#xff0c;列2 数据类型&#xff0c;列3 数据类型 ); #创建表以后添加 Alter table 表名 modify 列名 数据类型 not null&#xff1b; #删除 Alter tabl…

c语言数组转置原理,为什么这个数组转置不对?

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼原数组是1,2,34,5,67,8,9转置后的数组是1,4,72,5,83,6,9但结果出来的是乱七八糟的数字&#xff0c;而且最后提示出错#includevoid TransposedArray(int Arr[3][3]){shortint i,j;shortint Med;for(i0;i<2;i){for(j0;j<2;j){i…

Java数据库篇5——事务

Java数据库篇5——事务 1、什么是事务 事务是一个整体,由一条或者多条SQL 语句组成,这些SQL语句要么都执行成功,要么都执行失败, 只要有 一条SQL出现异常,整个操作就会回滚,整个业务执行失败 2、事物的特征 原子性&#xff1a;事务是不可再分的最小的操作单位一致性&#x…

c语言里寄存器.1说明意思,C语言复习+寄存器地址名称映射

C语言复习寄存器地址名称映射一.参考资料探索者STM32F4开发板&#xff1a;**《STM32F4开发指南-库函数版本》4.1小节C语言基础知识复习4.6小节 MDK中寄存器地址名称映射**STM32F4xx官方资料&#xff1a;《STM32F4xx中文参考手册》-第7章通用IO二.C语言复习位操作GPIOA->ODR|…

Java数据库篇6——多表查询

Java数据库篇6——多表查询 1、笛卡尔积 交叉连接查询 设集合A{a, b}&#xff0c;集合B{0, 1, 2}&#xff0c;则两个集合的笛卡尔积为{(a, 0), (a, 1), (a, 2), (b, 0), (b, 1), (b, 2)} 2、 内连接查询 2.1、隐式内连接 SELECT 字段名 FROM 左表, 右表 WHERE 连接条件;多…

c语言编程经典实例利润,C语言经典编程实例100题解答

C语言经典编程实例100题 答案答案 C语言经典编程实例100题C语言程序实例100个(一) 【程序1】 题目:有1、2、3、4个数字&#xff0c;能组成多少个互不相同且无重复数字的三位数,都是多少, 1.程序分析:可填在百位、十位、个位的数字都是1、2、3、4。组成所有的排列后再去掉不满足…

Java数据库篇7——数据库设计

Java数据库篇7——数据库设计 1、第一范式 列不可再分 每一列属性都是不可再分的属性值&#xff0c;确保每一列的原子性两列的属性相近或相似或一样&#xff0c;尽量合并属性一样的列&#xff0c;确保不产生冗余数据 2、第二范式 属性完全依赖于主键或者说一个表只描述一件…