会员可以在此提问,百战程序员老师有问必答
对大家有帮助的问答会被标记为“推荐”
看完课程过来浏览一下别人提的问题,会帮你学得更全面
截止目前,同学们一共提了 132387个问题
人工智能/第三十二阶段:面试和成功求职的秘技/AI算法工程师,该怎么面试以及面试常见问题 36646楼
JAVA 全系列/第一阶段:JAVA 快速入门/面向对象详解和JVM底层内存分析 36647楼
Python 全系列/第十一阶段:重量级Web框架-Django/Redis的入门与应用(拓展) 36648楼
Python 全系列/第十阶段:Flask百战电商后台项目/Flask百战电商后台项目 36649楼
JAVA 全系列/第六阶段:项目管理与SSM框架/SpringMVC旧 36651楼
JAVA 全系列/第十五阶段:Spring Session会话管理/Spring Session 36652楼
Python 全系列/第二阶段:Python 深入与提高/GUI编程(隐藏) 36653楼
Python 全系列/第一阶段:Python入门/编程基本概念 36654楼
JAVA 全系列/第三阶段:数据库编程/SQL 语言 36656楼

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>多个小球运动</title><style>canvas{border: 1px solid;}</style>
</head>
<body>
    <canvas width="500px" width="400px">对不起你的浏览器不支持canvas</canvas>
    <script>
        var mycanvas=document.querySelector('canvas');
        var ctx=mycanvas.getContext('2d');
        function Circle(){
            this.r=Math.floor(Math.random()*20+6);
            this.x=Math.floor(Math.random()*(500-this.r));
            this.y=Math.floor(Math.random()*(400-this.r));
            this.dx=Math.floor(Math.random*10);
            this.dy=Math.floor(Math.random*8);
            this.color='rgb('+Math.floor(Math.random()*256)+','+Math.floor(Math.random()*256)+','+Math.floor(Math.random()*256)+')';
        }
        Circle.prototype.yd=function(){
            this.x+=this.dx;
            if(this.x<=this.r){
                this.dx=-this.dx
            }else if(this.x>=500-this.r){
                this.dx=-this.dx
            }
            this.y+=this.dy;
            if(this.y<=this.r){
                this.y=-this.dy
            }else if(this.y>=400-this.r){
                this.dy=-this.dy
            }
        }
       Circle.prototype.abs=function(){
           ctx.beginPath();
           ctx.arc(this.x,this.y,this.r,0,2*Math.PI);
           ctx.fillStyle=this.color;
           ctx.fill();
           ctx.closePath();
         

       }
       var arr=[];
           for(var i=0 ;i<4;i++){
               arr[i]=new Circle();
           }
           var timer=setInterval(function () {
               ctx.clearRect(0,0,mycanvas.width,mycanvas.height)
               for(var i=0;i<arr.length;i++){
                   arr[i].yd();
                   arr[i].abs();

               }
           },40)

    </script>
</body>
</html>

老师为啥我的球显示不了

WEB前端全系列/第九阶段:HTML5新特性模块/(旧)H5新特性 36657楼

package JDBC;

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

public class JdbcUtil {

    private static String driver;

    private static String jdbcUrl;

    private static String user;

    private static String password;


    static {
        //读取Properties文件
        ResourceBundle bundle = ResourceBundle.getBundle("src/JDBC/jdbc");
        driver = bundle.getString("driver");
        jdbcUrl = bundle.getString("jdbcUrl");
        user = bundle.getString("user");
        password = bundle.getString("password");

        try {
            //链接数据库
            Class.forName(driver);
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
    }

    /**
     * 获取Connection对象
     * @return
     */
    public static Connection getConnection(){
        Connection connection = null;
        try {
            connection = DriverManager.getConnection(jdbcUrl,user,password);
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return connection;
    }

    /**
     * 关闭Statement
     * @param statement
     */
    public static void closeStatement(Statement statement){
        if(statement!=null){
            try {
                statement.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }
    }

    /**
     *   关闭Connection
     * @param connection
     */
    public static void closeConnection(Connection connection){
        if(connection!=null){
            try {
                connection.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }
    }

    /**
     * 关闭所有资源
     * @param statement
     * @param connection
     */
    public static void closeAll(Statement statement,Connection connection){
        if(statement!=null){
            try {
                statement.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }
        if(connection!=null){
            try {
                connection.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }

    }


}


package JDBC;

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

import static JDBC.JdbcUtil.closeAll;
import static JDBC.JdbcUtil.getConnection;

public class jdbcTest02 {
    public static void main(String[] args) {
        jdbcTest02 jdbcT = new jdbcTest02();
        jdbcT.insertDepartments("教学部",19,19);
    }

    public void insertDepartments(String department_name,int department_id,int location_id){
        Connection connection = null;
        Statement statement = null;
        try {
            connection = JdbcUtil.getConnection();
            statement = connection.createStatement();
            String sql = "insert into departments value("+department_id+",'"+department_name+"',"+location_id+")";
            System.out.println(sql);
            statement.executeUpdate(sql);
        } catch (Exception e) {
            e.printStackTrace();
        }finally {
            closeAll(statement, connection);
        }
    }

}

老师能帮忙看一下哪里的问题嘛

JAVA 全系列/第三阶段:数据库编程/JDBC技术(旧) 36658楼

课程分类

百战程序员微信公众号

百战程序员微信小程序

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