我试图通过方法为类变量赋值.但是,在执行超出方法范围后,变量仍然初始化为默认值.我们如何在Java中实现这一目标?
我想通过调用方法hello()将x初始化为5.我不想通过使用构造函数或使用它来初始化.可能吗?
public class Test {
int x;
public void hello(){
hello(5,x);
}
private void hello(int i, int x2) {
x2 = i;
}
public static void main(String args[]){
Test test = new Test();
test.hello();
System.out.println(test.x);
}
}
Run Code Online (Sandbox Code Playgroud) 我曾与 oracle 合作,在哪里选择特定行范围内的数据,查询是:
SELECT * from TABLE WHERE rownum>0 AND rownum<=10
Run Code Online (Sandbox Code Playgroud)
HSQL 中相应的查询是什么?