Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Ask a question, how to refer to a single integer variable in java, when passing parameters.
Ask a question, how to refer to a single integer variable in java, when passing parameters.
The first thing to say is that there is no concept of pointer in java. One purpose of java is to reduce the programmer's memory management and pointer confusion. For your requirements, java can only be achieved by replacing your pointer requirements with methods, that is, replacing B with method B ().

Private static int a =1;

Public static void main(String[] args){

system . out . println(a);

a = 2;

system . out . println(a+" "+b());

}

Public static int b(){

Return to a;

}

If b involves assignment, you can change private static int b = 0;;

Then the method of b () returns a+b;

Don't dwell on this painful thing in the C era.