答案我就不写了,自己尝试。
public class Test {
public static void leftshift(int i, int j){
i+=j;
}
public static void main(String args[]){
int i = 4;
int j = 2;
leftshift(i, j);
System.out.println(i);
}
}
public class Demo{
public static void main(String[] args){
int[] a=new int[1];
modify(a);
System.out.println(a[0]);
}
public static void modify(int[] a){
a[0]++;
}
}
public class TestA {
int i;
void change(int i){
i++;
System.out.println(i);
}
void change1(TestA t){
t.i++;
System.out.println(t.i);
}
public static void main(String[] args) {
TestA ta = new TestA();
System.out.println(ta.i); //
ta.change(ta.i);//
System.out.println(ta.i); //
ta.change1(ta); //
System.out.println(ta.i);//
}
}
public class Test{
public static void main(String argv[]) {
Test t = new Test();
t.first();
}
class Value{
int i = 15;
}
public void first() {
int i = 5;
Value v = new Value();
v.i = 25;
second(v, i);
System.out.println(v.i);
}
public void second(Value v, int i) {
i = 0;
v.i = 20;
Value val = new Value();
v = val;
System.out.print(v.i + " " + i);
}
}
public class TestArgsValue {
public static void main(String[] args) {
int i = 10;
TestArgsValue tv = new TestArgsValue();
tv.method1(i);
System.out.println("i=" + i);
System.out.println();
Demo d = new Demo();
System.out.println(d);
tv.method2(d);
System.out.println("d.i = " + d.i);
}
public void method1(int i){
System.out.println("i=" + i++);
}
public void method2(Demo d){
System.out.println(d);
System.out.println("d.i : " + d.i++);
}
}
class Demo{
int i = 5;
}