老师,如何在网页源代码里面调出query黑色命令行
老师你好,不是很了解函数和函数对象的定义,可以大概讲解一下吗,太抽象了
老师您好,请问s1和s2是同一个对象吗,为什么==和equals都为true呢?
老师,我上完整个飞机游戏之后,感觉可以理解,但是大部分里面的方法阿类阿以前也是没有学过的,我需不需要去背这些东西等完全熟透了再去思考自己的小程序,还是说想好设计什么直接开始,什么不会了在这里抄呢。
或者说,学完了比较懵懂,感觉自己能理解,接下来我应该怎么去做?
老师,为啥copy模块没有属性?
老师,我按照视频中的方式修改了redis.conf配置文件,但是并没有生效,我在修改完数据库内容后是即时保存的,并不会按照设置的秒数等待。就是一修改数据库内容,马上就保存了,生成了dump.rdb文件,这是为什么呢?
init什么意思
我想让没选择的时候按钮隐藏起来,用v-show=计算属性,但是初始页面按钮还有,只有选择之后再叉了才会触发,这是什么原因呢?该怎么实现呢?
老师为什么我的是这个样子的,我也是按你的写法一步一步来的
case后面的表达式不可以用且或非逻辑运算符吗?为什么
老师好
容易理解通过控制距离左边和上边位置的距离,去实现移动。但代码
if self.direction =="L":
self.rect.left -=self.speed
为什么是通过+=或者-=self.speed 呢,通过速度的快慢去控制,这个不大理解
import java.util.Scanner; public class TestSalary { public static void main(String[] args) { Scanner s = new Scanner(System.in); System.out.println("***********我的薪水计算器***********"); System.out.println("1.输入 88,退出程序\n2.输入 66,计算下一个年薪"); while(true){ System.out.println("请输入月薪:"); int monthSalary = s.nextInt(); System.out.println("请输入一年几个月薪资:"); int months = s.nextInt(); int yearSalary = monthSalary*months; //年薪 System.out.println("年薪是:"+yearSalary); if(yearSalary>=200000){ System.out.println("恭喜你超越 98%的国人"); }else if(yearSalary>=100000){ System.out.println("恭喜你超越 90%的国人"); } System.out.println("输入 88,退出系统;输入 66,继续计算。"); int comm = s.nextInt(); if(comm==88){ System.out.println("系统退出!"); break; } if(comm==66) { System.out.println("继续计算下一个薪资"); continue; } } } }
老师,因为这个循环本身是死循环,跳出这个循环和不跳出这个循环,之后执行结果都一样,是不是continue就可加可不加
/** * 创建发送消息类 */ class ClientSend extends Thread { private Socket socket; public ClientSend(Socket socket){ this.socket = socket; } @Override public void run() { this.sendMsg(); } /** * 发送消息 */ private void sendMsg(){ Scanner scanner = null; PrintWriter pw = null; try { //键盘输入 scanner = new Scanner(System.in); //创建向对方输出消息的流对象 pw = new PrintWriter(this.socket.getOutputStream()); while (true){ String msg = scanner.nextLine(); if ("exit".equals(msg)){ break; } pw.println(msg); pw.flush(); } } catch (IOException e) { e.printStackTrace(); }finally { if (pw != null){ pw.close(); } if (scanner != null){ scanner.close(); } if(this.socket!=null){ try { socket.close(); } catch (IOException e) { e.printStackTrace(); } } } } } /** * 创建接收消息线程类 */ class ClientReceive extends Thread { private Socket socket; public ClientReceive(Socket socket){ this.socket = socket; } @Override public void run() { } /** * 接收消息的方法 */ private void receiveMsg(){ BufferedReader br = null; try { br = new BufferedReader(new InputStreamReader(this.socket.getInputStream())); while (true){ String msg = br.readLine(); System.out.println("他说: " +msg ); } } catch (IOException e) { e.printStackTrace(); }finally { if (br!=null){ try { br.close(); } catch (IOException e) { e.printStackTrace(); } } } } } public class PointSocketClient { public static void main(String[] args) { try { Socket socket = new Socket("127.0.0.1",8888); System.out.println("连接成功"); new ClientSend(socket).start(); new ClientReceive(socket).start(); } catch (IOException e) { e.printStackTrace(); } } }
/** * 创建发送消息类 */ class Send extends Thread{ private Socket socket; public Send(Socket socket){ this.socket = socket; } @Override public void run() { this.sendMsg(); } /** * 发送消息 */ private void sendMsg(){ Scanner scanner = null; PrintWriter pw = null; try { //键盘输入 scanner = new Scanner(System.in); //创建向对方输出消息的流对象 pw = new PrintWriter(this.socket.getOutputStream()); while (true){ String msg = scanner.nextLine(); if ("exit".equals(msg)){ break; } pw.println(msg); pw.flush(); } } catch (IOException e) { e.printStackTrace(); }finally { if (pw != null){ pw.close(); } if (scanner != null){ scanner.close(); } if(this.socket!=null){ try { socket.close(); } catch (IOException e) { e.printStackTrace(); } } } } } /** * 创建接收消息线程类 */ class Receive extends Thread{ private Socket socket; public Receive(Socket socket){ this.socket = socket; } @Override public void run() { this.receiveMsg(); } /** * 接收消息的方法 */ private void receiveMsg(){ BufferedReader br = null; try { br = new BufferedReader(new InputStreamReader(this.socket.getInputStream())); while (true){ String msg = br.readLine(); System.out.println("他说: " +msg ); } } catch (IOException e) { e.printStackTrace(); }finally { if (br!=null){ try { br.close(); } catch (IOException e) { e.printStackTrace(); } } } } } public class PointSocketServer { public static void main(String[] args) { ServerSocket serverSocket = null; try { serverSocket =new ServerSocket(8888); System.out.println("服务器启动等待连接....."); Socket socket = serverSocket.accept(); System.out.println("连接成功"); new Send(socket).start(); new Receive(socket).start(); } catch (Exception e) { e.printStackTrace(); }finally { if (serverSocket != null){ try { serverSocket.close(); } catch (IOException e) { e.printStackTrace(); } } } } }
老师我这个代码只有客户端给服务端发消息的收回会输出
服务端给客户端发消息时没有反应,麻烦老师看下
有时候需要导包有很多选择,请问怎么选择应该导哪个包呢
非常抱歉给您带来不好的体验!为了更深入的了解您的学习情况以及遇到的问题,您可以直接拨打投诉热线:
我们将在第一时间处理好您的问题!
关于
课程分类
百战程序员微信公众号
百战程序员微信小程序
©2014-2025百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园网站维护:百战汇智(北京)科技有限公司 京公网安备 11011402011233号 京ICP备18060230号-3 营业执照 经营许可证:京B2-20212637