list.pop(【index】)什么意思,视频里面的解释有点看不懂
为什么print员工数和平均薪资都要是{0},我用{0}和{1}的时候会报错?
老师我这都是对着弄的,为什么链接不上
jdbcUtil
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(); } } } }
jdbcTset
package com.bjsxt; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.sql.Statement; public class jdbcTest { //向department添加一条数据 public void insertDepartments(String department_name, int location_id){ Connection conn = null; Statement state = null; try { //驱动注册 //创建连接 conn = jdbcUtil.getConnection(); String sql = "insert into departments values(default,'"+department_name+"',"+location_id+")"; state = conn.createStatement(); int flag = state.executeUpdate(sql); System.out.println(flag); } catch (Exception e) { e.printStackTrace(); }finally { jdbcUtil.closeStatement(state); jdbcUtil.closeConnection(conn); } } //更新数据 public void updateDepartments (String department_name,int location_id,int department_id){ Connection conn = null; Statement state = null; try{ conn = jdbcUtil.getConnection(); String sql = "update departments d set d.department_name = '"+department_name+"',d.location_id ="+location_id+" where d.department_id = "+department_id; int flag = state.executeUpdate(sql); System.out.println(flag); }catch (Exception e){ e.printStackTrace(); }finally { jdbcUtil.closeStatement(state); jdbcUtil.closeConnection(conn); } } public static void main(String[] args) { jdbcTest test = new jdbcTest(); //test.insertDepartments("研发部",8); test.updateDepartments("研发部4",6,3); //test.insertDepartments("教学部",9); } }
properties中
driver=com.mysql.jdbc.Driver jdbcUrl=jdbc:mysql://localhost:3306/bjsxt?useUnicode=true&characterEncoding=utf-8 username=root userpassword=niehan
看不出来是什么原因 为什么提示未连接呢?
老师,button组件可以这样写吗
老师我想让动画用while一直循环就卡死了是为什么啊
老师打开一直提示错误,一直找不到原因,请老师帮忙!
下面附源码
一、课堂代码
public void searchByName(){ TelNoteRegex telNoteRegex = new TelNoteRegex(); String name = telNoteRegex.nameValidate(); boolean flag = true; for (Person i:this.list) if (name.equals(i.getName())){ System.out.println(i); flag = false; } if(flag) System.out.println("查无此人"); }
二、尝试代码
public void searchByName(){ TelNoteRegex telNoteRegex = new TelNoteRegex(); String name = telNoteRegex.nameValidate(); for (Person i:this.list) if (name.equals(i.getName())){ System.out.println(i); return; } System.out.println("查无此人"); }
三、问题
感觉直接跳出的话会更省事,不知道对不对,这两种模式有什么差别?
底下同学的授权问题:
把密码那一段删了就行
//老师,请问一下,varj=1;这个声明定义的位置,放在var i=1;的后面不产生效果?而要在放在while循环里面 才能产生图二的效果。 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>作业1</title> </head> <body> <script> //用while循环打印九九乘法表 var i=1; var j=1; while (i<=9){ while (j<=i){ document.write(j+"*"+i+"="+j*i+" "+" "); j++; } i++; document.write("</br>"); } //用while循环打印九九乘法表 var i=1; while (i<=9){ var j=1; while (j<=i){ document.write(j+"*"+i+"="+j*i+" "+" "); j++; } i++; document.write("</br>"); } </script> </body> </html>
csv文件是怎么创建的,没有看明白,谢谢
老师你好,请问为什么我这调不出databases
老师,请问这个二维数组,想要进行寻找大于指定数字的商品,如何写代码?再者就是计算二维数组时,需要买的最终优惠的价格如何得出?
老师,6分58秒为什么orderid变成了7?不应该是4吗?
方法成功调用了 但是没有收到短信 控制台也没有发送记录
非常抱歉给您带来不好的体验!为了更深入的了解您的学习情况以及遇到的问题,您可以直接拨打投诉热线:
我们将在第一时间处理好您的问题!
关于
课程分类
百战程序员微信公众号
百战程序员微信小程序
©2014-2025百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园网站维护:百战汇智(北京)科技有限公司 京公网安备 11011402011233号 京ICP备18060230号-3 营业执照 经营许可证:京B2-20212637