能通俗解释一下反射吗(为什么要有反射,它解决了啥问题)
oldLu讲得太术语化
老师,isinstance是什么意思??
问题1:老师,关于迟到处理意见的代码,我自己写的代码里没有用return进行返回,直接用的无返回值类型void,代码如下,也可以正常运行。不知道是否也算是正确完成代码:
package cn.itbaizhan; public class TestMethod01 { public static void main(String[] args) { Late(8,42000.00); Late(18,42000.00); Late(28,42000.00); Late(48,42000.00); Late(88,42000.00); } public static void Late(double minute,double salary){ if(minute>=1&&minute<=10){ System.out.println("迟到"+minute+"分钟,"+"处理意见:"+"警告"); }else if(minute<=20){ System.out.println("迟到"+minute+"分钟,"+"处理意见:"+"罚款100元"); }else if(minute<=30){ System.out.println("迟到"+minute+"分钟,"+"处理意见:"+"罚款200元"); }else if(minute<=60){ System.out.println("迟到"+minute+"分钟,"+"处理意见:"+"扣除半日工资"+salary/30/2+"元"); }else if(minute>60){ System.out.println("迟到"+minute+"分钟,"+"处理意见:"+"按旷工计算,扣除三日工资"+3*salary/30+"元"); } } }
问题2:关于return的含义,我是否可以理解为当前方法的输出结果?
老师为什么我的窗口才执行一次
老师我想知道为什么第一次会找不到" java.lang.ClassNotFoundException: Welcome"然后在下一个”D:\mycode>java Welcome.java“就成功出现了"Hello,Word!"
老师,你这个sql语句是不是后面两行有点问题,id是主键,主键不是应该不能重复的么
def createWidget(self): self.photos = [PhotoImage(file="puke/puke"+str(i + 1)+".gif") for i in range(10)] self.pukes = [Label(root, image=self.photos[i]) for i in range(10)] for i in range(10): self.pukes[i].place(x=10+i*40, y=80) self.pukes[9].bind_class("Label", "<Button-1>", self.chupai)
老师,这里的self.pukes[0] 换成1-9的数字也能实现绑定class的功能呢 为啥绑定的不是某一张牌
这里安装一直失败
于是就运行./configure安装
一、截图
二、问题
1.在热部署已经关闭,并重启idea的情况下,只要在idea中作修改,cpu就会满负荷计算,之后我尝试了不运行若依程序,仅在idea中编辑也是同样的状况,这个cpu的计算是产生于idea对文件之间的关联处理吗?
2.我如何操作,能让idea在编辑时暂时不计算,在需要时再开启,以提升编辑时的流畅性呢
老师这个tag===ts是什么意思,ts好像是文件名
老师您好,为什么这种方式导入一个类,就可以完成mysql数据参数的配置,from_object这个函数,接受了这个Config类就意味着,参数已经进来了对吗?
package com.itbaizhan; import java.sql.Connection; import java.sql.Statement; /** * Statement对象的使用 */ public class StatementTest { /** * 添加用户 */ public void insertUsers(String username,int userage){ Connection connection = null; Statement statement = null; try{ //获取Connection对象 connection = JdbcUtils.getConnection(); //获取Statement对象 statement = connection.createStatement(); //定义需要执行的SQL语句 String sql = "insert into users values(default,'"+username+"',"+userage+")"; //执行SQL,返回boolean值,如果SQL有结果集返回,那么返回值为true,如果没有结果集返回,则返回false. boolean execute = statement.execute(sql); System.out.println(execute); }catch(Exception e){ e.printStackTrace(); }finally{ JdbcUtils.closeResource(statement,connection); } } } package com.itbaizhan; import java.io.InputStream; import java.sql.*; import java.util.Properties; /** * 工具类 */ public class JdbcUtils { private static String url; private static String name; private static String pwd; static { try { //实例化Properties对象 Properties prop = new Properties(); //获取读取properties文件的字节输入流对象 InputStream is = JdbcTest2.class.getClassLoader().getResourceAsStream("jdbc.properties"); //读取properties文件并解析 prop.load(is); //获取连接数据库的url url = prop.getProperty("url"); //获取连接数据库的用户名 name = prop.getProperty("name"); //获取连接数据库的pwd pwd = prop.getProperty("pwd"); //获取数据库驱动全名 String drivername = prop.getProperty("driver"); //加载并注册驱动 Class.forName(drivername); } catch (Exception e) { e.printStackTrace(); } } //获取数据库连接对象 public static Connection getConnection(){ Connection connection = null; try{ connection = DriverManager.getConnection(url,name,pwd); }catch(SQLException e){ e.printStackTrace(); } return connection; } //关闭连接对象 public static void closeConnection(Connection connection){ try{ connection.close(); }catch(SQLException e){ e.printStackTrace(); } } //提交事务 public static void commit(Connection connection){ try{ connection.commit(); }catch(SQLException e){ e.printStackTrace(); } } //事务回滚 public static void rollback(Connection connection){ try{ connection.rollback(); }catch(SQLException e){ e.printStackTrace(); } } //关闭Statement对象 public static void closeStatement(Statement statement){ try{ statement.close(); }catch(SQLException e){ e.printStackTrace(); } } //关闭ResultSet public static void closeResulSet(ResultSet resultSet){ try{ resultSet.close(); }catch(SQLException e){ e.printStackTrace(); } } //DML操作时关闭资源 public static void closeResource(Statement statement,Connection connection){ //先关闭Statement对象 closeStatement(statement); //再关闭Connection对象 closeConnection(connection); } //查询时关闭资源 public static void closeResource(ResultSet resultSet,Statement statement,Connection connection){ //先关闭ResultSet closeResulSet(resultSet); //再关闭Statement对象 closeStatement(statement); //最后关闭Connection对象 closeConnection(connection); } } package com.itbaizhan; public class Test { public static void main(String[] args) { StatementTest statementTest = new StatementTest(); statementTest.insertUsers("Miao",19); } }
Statement_添加数据时报错,实在找不到原因
一:遇到的问题:
老师,这里的td标签里面id属性的值为什么既加单引号又加双引号
二:代码区:
str+= "<tr align='center'><td id='"+this.userid+"'>"+this.userid +"</td></tr>"
老师,现在的
pom文件中我也添加了该启动坐标,但是在启动类中没有@EableAdminServer这个注解。
admin服务端可以正常启动,但是在网页中输入localhost:9090出来不来界面,求解
#coding=utf-8 #测试os.walk()递归遍历所有的子目录和子文件 import os all_files = [] path = os.getcwd() list_files = os.walk(path) for dirpath,dirnames,filenames in list_files: for dir in dirnames: all_files.append(os.path.join(dirpath,dir)) for file in filenames: all_files.append(os.path.join(dirpath,file)) #打印所有的子目录和子文件 for file in all_files: print(file)
为什么会需要第一行的代码,不是注释掉了吗?还会起作用吗?
非常抱歉给您带来不好的体验!为了更深入的了解您的学习情况以及遇到的问题,您可以直接拨打投诉热线:
我们将在第一时间处理好您的问题!
关于
课程分类
百战程序员微信公众号
百战程序员微信小程序
©2014-2025百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园网站维护:百战汇智(北京)科技有限公司 京公网安备 11011402011233号 京ICP备18060230号-3 营业执照 经营许可证:京B2-20212637