6.3 Comparison methods are no arguments and alignment parameters

  There are parameters: parentheses among the content, methods need some data when a condition to complete the task when there is a parameter.

      For example, two numbers together, you must know how much each of the two numbers to be added.

  No argument: among the empty parentheses, a method does not require any data condition that he will be able to complete the task independently, it is no argument.

      For example, a method is defined, 10 times the fixed print helloWorld.

Example:

{class Demo03MethodParam public 
    public static void main (String [] args) { 
        the method1 (10,20); 
        System.out.println ( "==============="); 
        method2 () ; 

    } 
    // multiplying two numbers, multiply, must know the two numbers is the number, or can not be calculated 
    // parameters have 
    public static void the method1 (A int, int B) { 
        int Result = A * B; 
        the System .out.println ( "the result is:" result +); 
    } 
    // print out, for example, a fixed text string 10 
    public static void method2 () { 
        for (int I = 0; I <10; I ++) { 
            the System. Out.println ( "the HelloWorld"); 
        } 

    } 
}

  

Results of the:

Guess you like

Origin www.cnblogs.com/sdrbg/p/11108843.html