================================================================
First, the static usage is:
1.static the methods and variables that are decorated belong to the class itself, not to the object, regardless of how many object instances are created to share a method and variable.
2. Static methods can not call non-static methods, Non-static methods can invoke static methods.
Secondly
In your first program, main () is a static method, it calls the Yes_no () method, the Yes_no method must be static, so the first one to use static.
Again
The second method is to invoke Printlnfo () directly from the object by calling its internal method, not the main () method. So you don't need to use static modification.
I don't know if you understand that.
There are two sections of programs: public class basic{public static void Main (string[] args) {yes_no (2008); ###### void Yes_no (int year) {if year%4==0&&year%100!=0| | year%400==0) System.out.print (year+) is a leap year.
"); else System.out.print (year+) is not a leap year.
");
-----------------------------------------------------------------public class basic{String name;
int age;
Public Basic (String Name,int age) {this.name=name;
This.age=age;
The public static void Printinfo () {System.out.println (name+) already has the "+age+" age. ");}
Public ###### void Main (string[] args) {String name= "Jim";
int age=19;
Basic temp = new Basic (name,age);
Temp.printinfo (); }
}