这就是我到目前为止所拥有的
@echo off
:Ask
echo Would you like to use developer mode?(Y/N)
set INPUT=
set /P INPUT=Type input: %=%
If %INPUT%=="y" goto yes
If %INPUT%=="n" goto no
If %INPUT%=="Y" goto yes
If %INPUT%=="N" goto no
:yes
java -jar lib/RSBot-4030.jar -dev
echo Starting RSbot in developer mode
:no
java -jar lib/RSBot-4030.jar
echo Starting RSbot in regular mode
pause
Run Code Online (Sandbox Code Playgroud)
无论哪种方式,如果用户输入y或n,它总是以-dev模式运行.
如果答案是肯定的,如何让它在-dev模式下运行,如果答案为否,我如何使它在常规模式下运行.另外,如果输入不是Y,N,y或n,如何再次询问?
以下代码打印"String"
public class Riddle {
public static void main(String[] args) {
hello(null);
}
public static void hello(Object o) {
System.out.println("Object");
}
public static void hello(String s) {
System.out.println("String");
}
}
Run Code Online (Sandbox Code Playgroud)
为什么代码编译?是不是空暧昧?
例如,由于签名模糊,以下代码将无法编译.
public class Riddle {
public static void main(String[] args) {
hello(null);
}
public static void hello(Object o) {
System.out.println("Object");
}
public static void hello(Integer o) {
System.out.println("Integer");
}
public static void hello(String s) {
System.out.println("String");
}
}
Run Code Online (Sandbox Code Playgroud)
有人可以解释为什么第一个例子可以编译而没有模棱两可的错误?
我一直试图找到在类的结束'}'之前插入一个空行并且没有找到它的选项.
我的目标是格式化
interface IShooter {
void incHealth(); // health++
void decHealth(); // health--
int getHealth();
}
Run Code Online (Sandbox Code Playgroud)
对此
interface IShooter {
void incHealth(); // health++
void decHealth(); // health--
int getHealth();
}
Run Code Online (Sandbox Code Playgroud) 我知道JVM存在固有的开销,我想进一步研究以确切了解开销的来源.
使用YourKit探查器,我发现有巨大的int []充满了看似随机的信息.我的猜测是,这些存储了JVM用于优化应用程序的一些性能指标和其他内容; 但令我惊讶的是,所有元素都是有价值的0
.
为了得到我的结果,我使用了以下"无所事事"程序,因此结果只包括JVM上发生的事情.
public final class Main {
public static void main(String[] args) throws InterruptedException {
Thread.sleep(Long.MAX_VALUE);
}
}
Run Code Online (Sandbox Code Playgroud)
这是分析结果的屏幕截图,如有必要,我可以上传内存快照.
我正在制作一个基于Java的屏幕截图应用程序,我想这样做当你在键盘上按下一组键时,就像这个视频发生在屏幕上你选择和区域的地方,它需要一个屏幕截图选定的地区.
如何使用鼠标选择要捕获的区域?
我正在研究Jetbrains的FernFlower 分叉,我一直在为它添加一些小改进.
关于FernFlower真正让我恼火的一件事是它基于bpush/spush等中的值来定位局部变量的类型.而Jode和Procyon以某种方式找到了找到局部变量原始值的方法.
这是原始源代码.
public static void main(String[] args) throws Exception {
int hello = 100;
char a2 = 100;
short y1o = 100;
int hei = 100;
System.out.println(a2+" "+y1o+", "+hei+", "+hello);
}
Run Code Online (Sandbox Code Playgroud)
使用FernFlower反编译时,它会输出:
public static void main(String[] args) throws Exception {
byte hello = 100;
char a2 = 100;
byte y1o = 100;
byte hei = 100;
System.out.println(a2 + " " + y1o + ", " + hei + ", " + hello);
}
Run Code Online (Sandbox Code Playgroud)
但是当使用Jode/Procyon进行反编译时,它会输出原始的局部变量类型:
public static void …
Run Code Online (Sandbox Code Playgroud) 我一直在体验SWT(GUI lib Eclipse使用),我想使用Swing创建以下内容.
之前的屏幕截图是使用SWT通过以下代码完成的
public static void main(String[] args) {
Display display = new Display();
final Shell shell = new Shell(display, SWT.RESIZE);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
Run Code Online (Sandbox Code Playgroud)
我想知道,我怎么可能在Swing中模仿这个?
PS这个Shell周围的边框目前是我的Windows配色方案的原生边框,我不想创建一个MatteBorder并模拟颜色,我想使用原生边框的窗口.
我已经在Intellij上遇到了这个问题很长一段时间了,当你的鼠标离开父实体后,子菜单会立即关闭.我制作了一个视频,展示了Eclipse与IntelliJ中的菜单,以及当将鼠标移向菜单时eclipse有多延迟,以便您可以选择到达目标的最短路径,而在intellij中,您必须将鼠标滑动父实体,直到您进入菜单,以便它不关闭.
https://www.youtube.com/watch?v=rOofU_CY1ZE
这是IntelliJ的问题吗?或者它是一个可以改变的设置?
谢谢!!!
我在until
下面的循环中使用了infix fun
for (x in 0 until bodies.size) bodies[x]()
Run Code Online (Sandbox Code Playgroud)
在使用YourKit分析我的代码时,我注意到我有大量的IntRange对象(大约2k/sec).
当我切换循环以int...int
直接使用rangeTo时,它不会产生任何垃圾.
for (x in 0..bodies.size-1) bodies[x]()
Run Code Online (Sandbox Code Playgroud)
有人可以解释这两者之间的区别吗?从我所能说的Int.until
只是回归this .. to
public infix fun Int.until(to: Int): IntRange {
val to_ = (to.toLong() - 1).toInt()
if (to_ > to) throw IllegalArgumentException("The to argument value '$to' was too small.")
return this .. to_
}
Run Code Online (Sandbox Code Playgroud) 好吧所以我正在编写一个编译器,我正在尝试使用局部变量表中的信息来确定变量的名称/类型.
我有以下代码:
public void noob() {
try {
int hello = 0;
short yo = 1;
byte y = 2;
int[] e = new int[9];
System.out.println(y + ", " + hello + ", " + yo+", "+e);
} catch (Exception var6) {
var6.printStackTrace();
}
}
Run Code Online (Sandbox Code Playgroud)
阅读变量表时,我得到以下内容:
LocalVariable{uid=-1, start=0, end=69, nameIndex=30, typeIndex=31, varIndex=0, name='this', typeName='LMain;'}
LocalVariable{uid=-1, start=2, end=60, nameIndex=37, typeIndex=18, varIndex=1, name='hello', typeName='I'}
LocalVariable{uid=-1, start=4, end=60, nameIndex=38, typeIndex=39, varIndex=2, name='yo', typeName='S'}
LocalVariable{uid=-1, start=6, end=60, nameIndex=40, typeIndex=41, varIndex=3, name='y', typeName='B'}
LocalVariable{uid=-1, start=12, …
Run Code Online (Sandbox Code Playgroud)