在调试期间,我可以设置 SASM 以显示我在寄存器(eax、ebx ..)中的值的二进制表示以及十六进制和十进制的值吗?
我有一个接口和2个实现它的类,第三个类有2个方法 - 一个获取第一个类对象作为参数,第二个获取另一个.我有一个包含两种类型对象的向量,我想在每个元素上使用第三个函数的方法而不必转换类型,因为我不知道每个向量元素是什么类型.我怎样才能做到这一点?这是代码:
public interface Transport {
}
public class Car implements Transport {
}
public class Bike implements Transport {
}
public class Operation {
public void operation(Car c) {
System.out.println("1");
}
public void operation(Bike b) {
System.out.println("2");
}
Run Code Online (Sandbox Code Playgroud)
主要是我有这个:
Transport[] t = new Transport[3];
t[0] = new Car();
t[1] = new Bike();
t[2] = new Car();
Operation op = new Operation();
op.operation(t[0]); // here I get the error - method not applicable for arguments
Run Code Online (Sandbox Code Playgroud)
这段代码是我所做的简化版本,为了更容易阅读,不仅有三个元素,它们是根据它获得的输入在for循环中创建的.
我需要为排序算法制作一个大的测试文件.为此,我需要生成1000万个随机字符串.我怎么做?我尝试在/ dev/urandom上使用cat,但它会持续几分钟,当我查看文件时,只有大约8页的字符串.如何在bash中生成1000万个字符串?字符串长度应为10个字符.