会员可以在此提问,百战程序员老师有问必答
对大家有帮助的问答会被标记为“推荐”
看完课程过来浏览一下别人提的问题,会帮你学得更全面
截止目前,同学们一共提了 132602个问题

package com.bjsxt;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ResourceBundle;

/*
* jdbc工具类
* */
public class JdbcUtil {
    private static String driver;
    private static String jdbcUrl;
    private static String username;
    private static String userpassword;
    static {
        //读取properties文件
        ResourceBundle bundle = ResourceBundle.getBundle("jdbc");
        driver = bundle.getString("driver");
        jdbcUrl = bundle.getString("jdbcUrl");
        username = bundle.getString("username");
        userpassword = bundle.getString("userpassword");
        try {
            Class.forName(driver);
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
    }
    //获取Connection对象
    public static Connection getConnection(){
        Connection conn = null;
        try {
            conn = DriverManager.getConnection(jdbcUrl,username,userpassword);
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return conn;
    }
    //关闭statement
    public static void closeStatement(Statement state){
        if (state != null){
            try {
                state.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }
    }
    //关闭Connection
    public static void closeConnection(Connection conn){
        if (conn != null){
            try {
                conn.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }
    }
    //关闭资源
    public static void closeResource(Statement state ,Connection conn){
        closeStatement(state);
        closeConnection(conn);
    }
}[object Object]

image.png

image.png

这个问题实在找不到为什么?看不出来哪里报错??????



JAVA 全系列/第三阶段:数据库编程/JDBC技术(旧) 24706楼
Python 全系列/第五阶段:数据库编程/mysql介绍与环境安装 24707楼
JAVA 全系列/第二阶段:JAVA 基础深化和提高/异常机制 24708楼
人工智能/第七阶段:机器学习-无监督学习(旧)/EM算法和GMM高斯混合模型 24709楼
Python 全系列/第一阶段:Python入门/编程基本概念 24711楼
JAVA 全系列/第六阶段:项目管理与SSM框架/Mybatis 24712楼
JAVA 全系列/第七阶段:生产环境部署与协同开发/Linux 24716楼
Python 全系列/第一阶段:Python入门/函数和内存分析 24717楼
Python 全系列/第二阶段:Python 深入与提高/文件处理 24718楼

pygame
SCREEN_WIDTH=SCREEN_HIGHT=BG_COLOR=pygame.Color()
MainGame():
    window=():
        ():
        pygame.display.init()
        MainGame.widow=pygame.display.set_mode([SCREEN_WIDTHSCREEN_HIGHT])
        pygame.display.set_caption()
        :
            MainGame.window.fill(BG_COLOR)
            pygame.display.update()
    ():
        Tank():
    ():
        ():
        ():
        ():
        MyTank():
    ():
        EnemyTank(Tank):
    ():
        ().()
Bullet():
    ():
        ():
        ():
        Wall():
    ():
        ():
        Explode():
    ():
        ():
        Music():
    ():
        ():
        __name__==:
    MainGame().startGame()

C:\Users\86137\PycharmProjects\mypro01\venv\Scripts\python.exe C:/Users/86137/PycharmProjects/mypro01/tanke01.py

pygame 2.0.1 (SDL 2.0.14, Python 3.9.2)

Hello from the pygame community. https://www.pygame.org/contribute.html

Traceback (most recent call last):

  File "C:\Users\86137\PycharmProjects\mypro01\tanke01.py", line 101, in <module>

    MainGame().startGame()

  File "C:\Users\86137\PycharmProjects\mypro01\tanke01.py", line 48, in startGame

    MainGame.window.fill(BG_COLOR)

AttributeError: 'NoneType' object has no attribute 'fill'


Process finished with exit code 1

运行的时候为什么是fill错误呀、、、

Python 全系列/第二阶段:Python 深入与提高/游戏开发-坦克大战 24719楼
JAVA 全系列/第三阶段:数据库编程/JDBC技术 24720楼

课程分类

百战程序员微信公众号

百战程序员微信小程序

©2014-2025百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园
网站维护:百战汇智(北京)科技有限公司
京公网安备 11011402011233号    京ICP备18060230号-3    营业执照    经营许可证:京B2-20212637