1.JDBC编程和MySQL数据库
数据库的连接(以前写qq项目时的代码)
package com.wu.Util;
import java.sql.*;
public class JDBCUtil {private static JDBCUtil jdbcUtil = null;private JDBCUtil() {}public static JDBCUtil getJdbcUtil() {if (jdbcUtil == null){return new JDBCUtil();}return jdbcUtil;}static {try {Class.forName("com.mysql.cj.jdbc.Driver");} catch (Exception e) {e.printStackTrace();}}public Connection getConnection() throws Exception {return DriverManager.getConnection("jdbc:mysql://localhost:3306/qq?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone = GMT&allowPublicKeyRetrieval=true","root","111111");}//关闭数据库连接public void closeConnection(ResultSet resultSet, Statement statement, Connection connection) {try {resultSet.close();} catch (Exception e) {e.printStackTrace();}finally {try {statement.close();} catch (Exception e) {e.printStackTrace();}finally {try {connection.close();} catch (Exception e) {e.printStackTrace();}}}}
}
2.文件IO流
Java中的IO流stream
输入流:InputStream(字节)和Reader(字符)作为基类
输出流:OutputStream(字节)和Writer(字符)作为基类
对象的序列化
Serializable接口
3.多线程
Thread类:线程类
Runnable接口:
synchronized(对象),加锁,其它线程进入之前必须先获得锁。
4.网络编程
后面再补
5.项目需求:
6.项目结构
服务端还没写,想先把界面学一学