java I

今天闲着就想起学学java,还不错,挺顺畅的,主要是多态之类的。

E1:

what.java

import ok.*;
 class abc extends ok{
 	public abc()
 {
  System.out.print("abc() called;\n");
 }
 
 public void x()
 {
  System.out.print("abc.x() called;\n");
 }
 public void x2()
 {
  System.out.print("abc.");
  super.x();
 }
}
 class abc2 extends ok{
 private int x=0;
 private int y=0;
 
 public abc2()
 {
  System.out.print("abc2() called;\n");
 }
 
 public void x()
 {
  System.out.print("abc2.x() called;\n");
 }
 public void x2()
 {
  System.out.print("abc2.");
  super.x();
 }
}
 public class what{
 public static void main(String args[])
 {
  try{
  ok[] y={new abc2(),new abc(),new abc2()};
  for(ok e : y){
   e.x();
   try{
    ((abc)e).x2();
    }
    catch(Exception x){
     ((abc2)e).x2();
     //x.printStackTrace(System.out);
     //throw x;
    }
  }
 }catch(Exception x){
     System.out.print("The upper Deal!\n");
     x.printStackTrace(System.out);
    }
 }
}

./ok/ok.java

package ok;
abstract public class ok{
 protected int ac=1;
 protected int bc=1;
 public ok()
 {
   System.out.print("ok() called;\n");
 }
 /*public ok(int abc,int ca)
 {
  this.ac=abc;
  this.bc=ca;
  System.out.println(ac);
  System.out.println(bc);
 }*/
 public void giveAnswer(){}
 
 public void x(){
  System.out.print("super of x() called;\n");
 }
}

output:

ok() called;
abc2() called;
ok() called;
abc() called;
ok() called;
abc2() called;
abc2.x() called;
abc2.super of x() called;
abc.x() called;
abc.super of x() called;
abc2.x() called;
abc2.super of x() called;

 

E2:

imp.java

interface Inte{
 void ok();
}
 class Abc implements Inte{
 public void ok(){
   System.out.println("Abc.ok() called!"); 
 }
}
class Problem implements Inte{
 public void ok(){
   System.out.println("Problem.ok() called!"); 
 }
}
public class imp{
 public static void main(String args[]){
   Inte[] temp={new Abc(),new Problem()};
   for(Inte e : temp){
    e.ok();
   }
 }
}

 output:

Abc.ok() called!
Problem.ok() called!

 

### 鼠标连点器的下载与使用教程 #### 软件功能概述 鼠标连点器是一种能够帮助用户自动完成重复性鼠标点击操作的工具,适用于多种场景,例如游戏操作、办公自动化等。其主要作用在于提升效率并减少手动操作带来的疲劳感[^1]。 #### 下载途径 通常情况下,鼠标连点器可以通过以下几种方式获取: - **官方网站**:许多开发者会提供官方版本供用户免费或付费下载。 - **第三方平台**:部分应用分发网站也会提供此类软件,但在选择时需注意安全性,避免下载到带有恶意代的版本。 - **自制脚本**:对于熟悉编程技术的用户来说,可以利用 Python 等语言自行开发适合自己的鼠标连点器[^4]。 #### 安装过程 安装鼠标连点器的过程相对简单,一般遵循以下流程: 1. 下载完成后打开 `.exe` 文件启动安装向导; 2. 按照提示逐步设置安装路径及其他参数,默认选项即可满足大部分需求; 3. 点击“完成”按钮结束整个安装环节[^2]。 #### 基础配置与使用说明 首次运行该类应用程序后,可能需要进行一定的初始化设定才能正常使用全部特性: - 设置触发条件:定义何时启用连续点击模式,比如通过指定快捷键实现开关控制。 - 自定义频率调节:依据实际应用场景调整每秒钟内的点击次数或者两次之间的时间间隔。 - 功能扩展支持:某些高级产品还允许绑定额外的功能模块,像图片识别定位目标位置再实施动作等功能[^3]。 #### 制作个性化解决方案 (可选) 如果现有市场上的成品无法完全契合个人特殊要求,则考虑借助开源社区资源学习如何构建专属方案也是一个不错的选择。以下是基于 Python 的简易示例代片段用于创建基础型鼠标连点器: ```python import time import threading from pynput.mouse import Button, Controller as MouseController from pynput.keyboard import Listener, KeyCode, Key delay = 0.01 button = Button.left start_stop_key = KeyCode(char='s') exit_key = KeyCode(char='e') class ClickMouse(threading.Thread): def __init__(self, delay, button): super().__init__() self.delay = delay self.button = button self.running = False self.program_running = True def start_clicking(self): self.running = True def stop_clicking(self): self.running = False def exit(self): self.stop_clicking() self.program_running = False def run(self): while self.program_running: while self.running: mouse.click(self.button) time.sleep(self.delay) mouse = MouseController() click_thread = ClickMouse(delay, button) click_thread.start() def on_press(key): if key == start_stop_key: if click_thread.running: click_thread.stop_clicking() else: click_thread.start_clicking() elif key == exit_key: click_thread.exit() listener.stop() with Listener(on_press=on_press) as listener: listener.join() ``` 上述脚本实现了简单的按键切换逻辑来开启/关闭自动点击行为,并提供了退出机制以便安全终止进程。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值