摘要: package Reflects; import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import jav 阅读全文
posted @ 2022-04-28 20:35 phpwyl 阅读(46) 评论(0) 推荐(0) 编辑
摘要: package Reflects; import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; /** * 通过反射 阅读全文
posted @ 2022-04-27 22:38 phpwyl 阅读(51) 评论(0) 推荐(0) 编辑
摘要: package Reflects; public class ReflectDemo{ public static void main(String[] args) throws ClassNotFoundException { Class<Actor> ac1 = Actor.class; Sys 阅读全文
posted @ 2022-04-27 21:06 phpwyl 阅读(122) 评论(0) 推荐(0) 编辑
摘要: package Streams; import java.util.ArrayList; /** * 需求,按照下面的要求完成集合的创建和遍历 * 创建一个集合存储多个字符串元素 * 把集合中所有以张开头的元素存储到一个新的集合 * 把:张 开头的集合中长度为3⃣️的元素存储到一个新的集合 * 遍历 阅读全文
posted @ 2022-04-25 22:39 phpwyl 阅读(17) 评论(0) 推荐(0) 编辑
摘要: package com; import java.util.function.Function; public class FuctionDemo { public static void main(String[] args) { convert("100",s -> Integer.parseI 阅读全文
posted @ 2022-04-25 21:58 phpwyl 阅读(6347) 评论(0) 推荐(0) 编辑
摘要: package com.runnable; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; public class ComparatorDemo { public stat 阅读全文
posted @ 2022-04-24 21:39 phpwyl 阅读(488) 评论(0) 推荐(0) 编辑
摘要: package com.interfaces; public class Demo3 { public static void main(String[] args) { test((name, age) -> new Student(name,age)); test(Student::new); 阅读全文
posted @ 2022-04-23 20:40 phpwyl 阅读(62) 评论(0) 推荐(0) 编辑
摘要: package com.interfaces; public class PrinterDemo { public static void main(String[] args) { usePrinter((String s)->{ System.out.println(s.toUpperCase( 阅读全文
posted @ 2022-04-23 17:55 phpwyl 阅读(73) 评论(0) 推荐(0) 编辑
摘要: package com.interfaces; public class Demo2 { public static void main(String[] args) { start(s-> Integer.parseInt(s)); //引用类方法 start( Integer::parseInt 阅读全文
posted @ 2022-04-23 17:42 phpwyl 阅读(9) 评论(0) 推荐(0) 编辑
摘要: package com.interfaces; public interface Inter { void show(); default void method(){ System.out.println("默认方法"); } public static void test(){ System.o 阅读全文
posted @ 2022-04-23 11:51 phpwyl 阅读(973) 评论(0) 推荐(0) 编辑
摘要: package com.interfaces; public interface InterfaceOne { void aa(); void bb(); default void cc(){ } } 默认方法不是抽象方法,所以不被强制重写,但可以被重写,重写时候要去掉default关键字 publ 阅读全文
posted @ 2022-04-23 09:42 phpwyl 阅读(183) 评论(0) 推荐(0) 编辑
摘要: package lambda; public interface Addable { int add(int x,int y); } package lambda; public class AddableDemo { public static void main(String[] args) { 阅读全文
posted @ 2022-04-18 21:07 phpwyl 阅读(24) 评论(0) 推荐(0) 编辑
摘要: package Inter; import java.io.*; import java.net.ServerSocket; import java.net.Socket; public class ServeDemo { public static void main(String[] args) 阅读全文
posted @ 2022-04-17 15:49 phpwyl 阅读(21) 评论(0) 推荐(0) 编辑
摘要: package Inter; import java.io.*; import java.net.Socket; public class ClientDemo { public static void main(String[] args) throws IOException { Socket 阅读全文
posted @ 2022-04-17 14:04 phpwyl 阅读(86) 评论(0) 推荐(0) 编辑
摘要: package Inter; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.DatagramPacket; import jav 阅读全文
posted @ 2022-04-14 22:40 phpwyl 阅读(33) 评论(0) 推荐(0) 编辑
摘要: package Inter; import java.io.IOException; import java.net.*; public class InetAddressDemo { public static void main(String[] args) throws IOException 阅读全文
posted @ 2022-04-13 22:50 phpwyl 阅读(128) 评论(0) 推荐(0) 编辑
摘要: package Multithreading; import java.util.*; public class BuyTicketDemo { public static void main(String[] args) { StringBuffer sb = new StringBuffer() 阅读全文
posted @ 2022-04-07 22:48 phpwyl 阅读(37) 评论(0) 推荐(0) 编辑
摘要: package Multithreading; /* 出现数据安全的原因 1。是否是多线程环境 2。是否是共享数据 3。是否有多条语句操作共享数据(打破此条件) 同步代码块的好处和弊端 好处:解决了多线程的数据安全问题 弊端:当线程很多时,因为每个线程都会去判断同步上的锁,这里很耗资源的,无形中会降 阅读全文
posted @ 2022-04-07 21:59 phpwyl 阅读(92) 评论(0) 推荐(0) 编辑
摘要: package Multithreading; public class MyRunnableDemo { public static void main(String[] args) { MyRunnable myRunnable = new MyRunnable(); Thread thread 阅读全文
posted @ 2022-04-07 20:34 phpwyl 阅读(14) 评论(0) 推荐(0) 编辑
摘要: package Multithreading; public class MyThreadDemo { public static void main(String[] args) { MyThread my1 = new MyThread("飞机"); MyThread my2 = new MyT 阅读全文
posted @ 2022-04-05 21:58 phpwyl 阅读(16) 评论(0) 推荐(0) 编辑
摘要: package Iodemo; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.ut 阅读全文
posted @ 2022-04-05 18:23 phpwyl 阅读(17) 评论(0) 推荐(0) 编辑
摘要: package Iodemo; import java.io.*; public class ObjectInputStreamDemo { public static void main(String[] args) throws IOException, ClassNotFoundExcepti 阅读全文
posted @ 2022-04-05 16:49 phpwyl 阅读(21) 评论(0) 推荐(0) 编辑
摘要: package Iodemo; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectOutput; import java.io.ObjectOutputStream; public cl 阅读全文
posted @ 2022-04-05 15:30 phpwyl 阅读(19) 评论(0) 推荐(0) 编辑
摘要: package Iodemo; import java.io.*; public class CopyAllDemo { public static void main(String[] args) throws IOException { File f = new File("/Volumes/m 阅读全文
posted @ 2022-04-05 13:05 phpwyl 阅读(57) 评论(0) 推荐(0) 编辑
摘要: package Iodemo; import java.io.*; /** * 复制单级目录 */ public class CopyOneDir { public static void main(String[] args) throws IOException { File srcFolder 阅读全文
posted @ 2022-04-04 10:57 phpwyl 阅读(20) 评论(0) 推荐(0) 编辑
摘要: import java.util.Comparator; import java.util.TreeSet; public class orderDemo { public static void main(String[] args) { TreeSet<Student> s = new Tree 阅读全文
posted @ 2022-03-31 23:09 phpwyl 阅读(77) 评论(0) 推荐(0) 编辑
摘要: JAVA 字符流读取和写入改进 ,用到读写便捷类 import java.io.*; public class CopyJavaDemo { public static void main(String[] args) throws IOException { File file = new Fil 阅读全文
posted @ 2022-03-30 23:18 phpwyl 阅读(29) 评论(0) 推荐(0) 编辑
摘要: import java.io.*; public class CopyJavaDemo { public static void main(String[] args) throws IOException { File file = new File("./src/CopyJavaDemo.jav 阅读全文
posted @ 2022-03-30 23:06 phpwyl 阅读(18) 评论(0) 推荐(0) 编辑
摘要: import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStreamReader; public class Input 阅读全文
posted @ 2022-03-30 22:50 phpwyl 阅读(73) 评论(0) 推荐(0) 编辑
摘要: import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStreamWriter; /* void write (i 阅读全文
posted @ 2022-03-30 22:19 phpwyl 阅读(63) 评论(0) 推荐(0) 编辑