sqyog
#DDL数据库操作 /* 创建数据库 create database if not exists 库名; 创建数据库指定字符集 create database 数据库名 character set 字符集; 创建数据库并且指定排序方式 create database 数据库名 collate 排序方式; 创建数据库并且指定字符集和排序方式 create database 数据库名 character set 字符集 collate 排序方式; 查询数据库字符集和排序方式 show variables like 'character_set_database'; show variables like 'collation_database'; */ CREATE DATABASE IF NOT EXISTS lianxi_db1 CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_as_cs; SHOW VARIABLES LIKE 'character_set_database'; SHOW...
sqlyog小技巧
title: sqyog小技巧cover: /image/a.pngdate: 2025-06-27 14:50:00coverWidth: 1200coverHeight: 750tags: - 标签categories: - 分类 ctrl+s(保存sql语句)
动态代理
package a07; public class BigStar implements Star{ String name; public BigStar() { } public BigStar(String name) { this.name = name; } /** * 获取 * @return name */ public String getName() { return name; } /** * 设置 * @param name */ public void setName(String name) { this.name = name; } public String toString() { return...
反射
package A05; public class Student { public String name; public int age; public Student() { } public Student(String name, int age) { this.name = name; this.age = age; } private Student(String name) { this.name = name; } /** * 获取 * @return name */ public String getName() { return name; } /** * 设置 * @param name */ public void...
TCP协议
package a04; import java.io.IOException; import java.io.OutputStream; import java.net.Socket; public class Client { public static void main(String[] args) throws IOException { /* tcp协议,发送数据 */ //1.创建socket对象(快递公司) Socket socket=new Socket("10.61.193.69",10000); //2.发送数据 OutputStream os=socket.getOutputStream(); //写出数据 os.write("你好! hello".getBytes()); //释放资源 ...
IP,UDP协议
IP: ------- import java.net.InetAddress; import java.net.UnknownHostException; public class MyInetAddressDemo1 { public static void main(String[] args) throws UnknownHostException { /* static inetaddress getByName(String host) 确定主机名称的IP地址。主机名称可以是机器名称,也可以是IP地址 String getHostName() 获取此IP地址的主机名。 string getHostAddress() 返回文本显示中的IP地址字符串。 */ InetAddress address=InetAddress.getByName("LAPTOP-BA8TSI01"); ...
多线程_线程池
package a01; public class MyRunnable implements Runnable{ @Override public void run() { for (int i = 0; i < 100; i++) { System.out.println(Thread.currentThread().getName()+"--->"+i); } } } ------------ package a01; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; public class MyThreadPoolDemo1 { public static void main(String[] args) { /* ...
多线程2
等待唤醒机制: -------------- public class Cook extends Thread{ @Override public void run() { while(true){ synchronized (Desk.lock){ if(Desk.count==0){ break; }else{ if(Desk.flag==0){ System.out.println("厨师正在做包子"); Desk.flag=1; Desk.lock.notify(); }else{ try { ...
多线程
public class MyCallable implements Callable { @Override public Object call() throws Exception { //返回值表示多线程运行结果 int sum=0; for (int i = 0; i < 100; i++) { sum+=i; } return sum; } } ------------------- public class MyRun implements Runnable{ @Override public void run() { for (int i = 0; i < 100; i++) { ...
IO
public class Test1 { public static void main(String[] args) throws IOException { /* 练习:文件夹拷贝 */ File src=new File("C:\\aaa\\ccc"); File dest=new File("C:\\aaa\\ddd"); //调用方法 copy(src,dest);//复制文件夹 } public static void copy(File src,File dest) throws IOException { //创建dest的文件夹,便于src复制 dest.mkdirs(); //进入数据源 File[] files = src.listFiles(); if...