Java return value
The structure of program one is like this, like SquareProperties. There are two common methods and one main method in this class. You can think of a method as a toolkit to implement a function. Double computeArea, the function of this method is to calculate the area. You enter a parameter side, and this method returns the calculated area value to you. The second is to find the circumference, and the same is true.

Calling these methods in the main method can directly realize the function of finding perimeter and area.

In the second program, the contents of these two methods are directly mixed into the main method.

You may think that the method of program 2 is more convenient now, but if you put all the functions in main when you make some formal software in the future, you can't reuse it, which is very chaotic. It is very convenient to package all kinds of functions into methods and use which one is needed.

Public static in program 2. Public is permission, which means that all programs, no matter where they come from, can call this variable.

Generally speaking, it can be kept secret. Try not to. For security and confidentiality.

Static static. That is to say, allocate a separate memory space for this variable, and anyone can call it. If this variable is not static, it is not static. And it is outside the main method and cannot be called by something inside the main. It is suggested to study local variables and global variables.

I was struggling with these things when I first learned JAVA. I didn't understand it all semester, and I didn't realize it until I learned the data structure next semester. If you don't understand, you can send HI privately, and I'll leave QQ or something.