For these two declaration methods, if they are not initialized and are local variables, their values are uncertain; If they are global variables, they default to 0. Open level test {private int num//( 1) declares integer variables! Public int getnum ()//(2) declares the method to get the value of this variable. {Return number; }
The Public void setNum(int num) //(2) declaration method designs the value of this variable {this.num = num}
public static void main(String[]args){ Test TT = new Test():TT . setnum( 123); //(3) Call the above two methods at the program access point (main). int result = TT . getnum(); System.out.println (result); //(4) Output the result of calling the method at an appropriate location.