当前位置: 首页 > news >正文

JAVA1026 方法;类:抽象类、抽象类继承;接口、接口继承 Linux:Mysql

Java

方法

格式

修饰符 返回值类型 方法名(参数类型1 参数名1, 参数类型2 参数名2, ...) {// 方法体:具体的执行代码return 返回值; // 如果返回值类型不是void,则必须使用return语句
}

在这里插入图片描述

public abstract class sabszijixie {public abstract  void gotoschooll();class students{private  String name;students(String name){this.name=new String(name);}}public void workhradly(Object o){gotoschooll();students k=new students("xiaocao");students cc=k;k.name="caoxiao";System.out.println(cc.name);}public static void main(String[] args){workhradly(null);}
}

D:\新建文件夹\java1024\sabszijixie.java:19:9
java: 无法从静态上下文中引用非静态 方法 workhradly(java.lang.Object)

如何运行一个项目里单个.java程序,直接点击运行整个项目就开了

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

抽象类

public abstract class sabszijixie {public static  void gotoschooll(){}static class students{private  String name;students(String name){this.name=new String(name);}}public abstract void playwar3();
//抽象方法不是不能写方法体吗?哦 继承时具体写public static void workhradly(Object o){gotoschooll();students k=new students("xiaocao");students cc=k;k.name="caoxiao";System.out.println(cc.name);}
public void play(Object o){playwar3();}public  static void main(String[] args){workhradly(null);}
}

继承抽象类

强制实现抽象类的抽象方法

public class sabszijixieextends extends sabszijixie{@Overridepublic void playwar3() {}
}

抽象类

public abstract class sabszijixie {public static  void gotoschooll(){}class students{private  String name;students(String name){this.name=new String(name);}public String getName() {return name;}public void setName(String name) {this.name = name;}
}public abstract void playwar3();
//抽象方法不是不能写方法体吗?哦 继承时具体写public static void workhradly(Object o){}
public void play(Object o){playwar3();System.out.println("123");
}public   void main(String[] args){workhradly(null);
//        gotoschooll();students k=new students("xiaocao");
//k是一个实例,属性是xiaocao 使用方法 k.属性 k.方法调用
//        students cc=k;
//        k.name="caoxiao";System.out.println(k.getName());}
}
// ctrl / 一键/
// 类名首字母大写 命名驼峰命名法
// static 加载速度大于非static

抽象类继承

public class test {public static void main(String[] args) {sabszijixieextends s =new sabszijixieextends();s.play(null);s.main(null);}}

在这里插入图片描述

接口

public interface boy {public void playLol();public void think();public void enjoylonely();
}

接口继承

public class boyiml implements boy{@Overridepublic void playLol() {}@Overridepublic void think() {}@Overridepublic void enjoylonely() {}
}

Linux

[caozx26@client ~]$ mysqladmin password 'root' -p
Enter password:
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'caozx26'@'localhost' (using password: YES)'
[root@client caozx26]# mysqladmin password 'root' -p
bash: mysqladmin: 未找到命令...
caozx26@192.168.235.200's password:┌────────────────────────────────────────────────────────────────────┐│                        • MobaXterm 20.0 •                          ││            (SSH client, X-server and networking tools)             ││                                                                    ││ ➤ SSH session to caozx26@192.168.235.200                           ││   • SSH compression : ✘                                            ││   • SSH-browser     : ✔                                            ││   • X11-forwarding  : ✔  (remote display is forwarded through SSH) ││   • DISPLAY         : ✔  (automatically set on remote server)      ││                                                                    ││ ➤ For more info, ctrl+click on help or visit our website           │└────────────────────────────────────────────────────────────────────┘Last login: Thu Oct 23 20:13:43 2025 from 192.168.235.1
[caozx26@client ~]$ mysql -uroot -p123
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.31 MySQL Community Server (GPL)Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> exit
Bye
[caozx26@client ~]$ mysql -S /tmp/mysql.sock -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.31 MySQL Community Server (GPL)Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> ^C
mysql> exit
Bye
[caozx26@client ~]$ mysql -e "show databases;" -uroot -p
Enter password:
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
[caozx26@client ~]$ mysql -e "show databases;" -uroot -e
mysql: [ERROR] mysql: option '-e' requires an argument
[caozx26@client ~]$ mysql -e "show databases;" -uroot -p
Enter password:
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
[caozx26@client ~]$ mysqladmin password '新密码' -p
Enter password:
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'caozx26'@'localhost' (using password: YES)'
[caozx26@client ~]$ mysqladmin password '111' -p
Enter password:
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'caozx26'@'localhost' (using password: YES)'
[caozx26@client ~]$ mysqladmin password 'root' -p
Enter password:
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'caozx26'@'localhost' (using password: YES)'
[caozx26@client ~]$ mysqladmin password 'root' -p
Enter password:
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'caozx26'@'localhost' (using password: YES)'
[caozx26@client ~]$ mysqladmin password 'root' -p
Enter password:
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'caozx26'@'localhost' (using password: YES)'
[caozx26@client ~]$ mysqladmin password 'root' -p
Enter password:
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'caozx26'@'localhost' (using password: YES)'
[caozx26@client ~]$ sudo su
[sudo] caozx26 的密码:
[root@client caozx26]# mysqladmin password 'root' -p
bash: mysqladmin: 未找到命令...
[root@client caozx26]# mysqladmin password 'root' -p
bash: mysqladmin: 未找到命令...
[root@client caozx26]# mysqladmin password 'root' -p
bash: mysqladmin: 未找到命令...
[root@client caozx26]# which mysqladmin
/usr/bin/which: no mysqladmin in (/sbin:/bin:/usr/sbin:/usr/bin)
[root@client caozx26]# bin/mysqladmin version -p
bash: bin/mysqladmin: 没有那个文件或目录
[root@client caozx26]# cd /mysql_3306/
[root@client mysql_3306]# bin/mysqladmin version -p
Enter password:
bin/mysqladmin  Ver 8.42 Distrib 5.7.31, for linux-glibc2.12 on x86_64
Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.Server version          5.7.31
Protocol version        10
Connection              Localhost via UNIX socket
UNIX socket             /tmp/mysql.sock
Uptime:                 2 days 19 hours 45 min 3 secThreads: 1  Questions: 20  Slow queries: 0  Opens: 107  Flush tables: 1  Open tables: 100  Queries per second avg: 0.000
[root@client mysql_3306]# netstat -tnlp |grep 3306
tcp6       0      0 :::3306                 :::*                    LISTEN      75205/mysqld
[root@client mysql_3306]# bin/mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 15
Server version: 5.7.31 MySQL Community Server (GPL)Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> set password=password('456')-> ;
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
mysql> ^C
mysql> exit
Bye
[root@client mysql_3306]# vim /mysql_3306/my.cnf
[root@client mysql_3306]# cat my.cnf
[mysqld]
basedir=/mysql_3306
datadir=/mysql_3306/data
socket=/tmp/mysql.sock
validate_password=OFF
[root@client mysql_3306]# service mysql_3306 restart
Shutting down MySQL.. SUCCESS!
Starting MySQL. SUCCESS!
[root@client mysql_3306]# mysql -uroot -p
bash: mysql: 未找到命令...
[root@client mysql_3306]# bin/mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.31 MySQL Community Server (GPL)Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> set password=password('456');
Query OK, 0 rows affected, 1 warning (0.00 sec)mysql>
http://www.dtcms.com/a/532158.html

相关文章:

  • 密码学系列 - 零知识证明(ZKP) - NTT与MSM的总结
  • 《解决界面交互痛点:WaterFlow 瀑布流、双层嵌套滚动、键盘避让与跨 Ability 跳转实践》
  • 网页设计建立站点步骤做网站的广告词
  • Spring Boot3零基础教程,生命周期启动加载机制,笔记64
  • StarGantt在线甘特图最新版本评测
  • 43.渗透-Kali Linux-工具-Ettercap(dns欺骗)
  • 详解C++中的迭代器
  • 区块链论文速读 CCF A--USENIX Security 2025(2)
  • 基于区块链的新能源管理平台的设计与实现(源码+文档)
  • 2025年10月26日 AI大事件
  • 企业建站个人建站源码沧州专业网站建设公司
  • 基于springboot的电影评论网站系统设计与实现
  • 1.2.1.3 大数据方法论与实践指南-一种跨团队业务结算方式探索
  • 西安地产网站建设百度手机管家
  • NoSQL 简介
  • C++ 分治 快速排序优化 三指针快排 力扣 面试题 17.14. 最小K个数 题解 每日一题
  • 网站建设业务员怎么做适合建设网站的国外服务器
  • 【第1章】基于FPGA的图像形态学处理学习教程——目录
  • stm32单片机命名规则,c6t6只有32KB,c8t6有64KB
  • 基于华为设备的 OSPF+MSTP+DHCP+NAT 综合网络架构实现
  • 使用uniapp——实现微信小程序的拖拽排序(vue3+ts)
  • 5.23基于 LabVIEW 的科学计算器设计
  • STM32 异常和中断
  • OWL 简介
  • 元器件网站建设案例网站建设专家联系方式
  • GStreamer实现屏幕录制(视频+麦克风音频)并编码成视频文件
  • asp网站开发教程pdf广安市建设局新网站
  • Actix Web 源码级拆解
  • 模拟32位浮点数的定义,加,减,显示。
  • GitHub等平台形成的开源文化正在重塑家庭日