Application of small chestnut return value block

Reference data types as parameters, the basic data types to make the case of the return value.

. 1  Package com.ccp.iu;
 2  public  class Test1 {
 . 3      public  static  void main (String [] args) {
 . 4          int SE = new new Test1 () SS ( "you are the best pig strange!." );
 5          System.out.println (SE);
 . 6          int [] = QQ new new . Test1 () XX ( "you are the best pig strange!" );
 . 7          for ( int I = 0; I <qq.length; I ++ ) {
 . 8              System.out.println (QQ [I]);
 . 9          }
 10      }
 . 11      public  intSS (String name) {
 12 is          int S1 = 0 ;
 13 is          IF ( "! You are the best pig strange" .equals (name)) {
 14              S1 =. 11 ;
 15          }
 16              return S1;
 . 17      }
 18 is      public  int [ ] XX (String name) {
 . 19          int [] X1 = new new  int [. 5 ];
 20 is          IF ( "you are the best pig strange!" {.equals (name))
 21 is              for ( int I = 0; I < x1.length; I ++ ) {
 22 is                  X1 [I] = X1 [I] +5 ;
 23 is             }
24         }
25         return x1;
26     }
27 }

Using blocks to complete the initial value is stored in the entity

 1 package com.ccp.iu;
 2 
 3 public class Test2 {
 4 
 5     public static void main(String[] args) {
 6         Test2 test2=new Test2();
 7     }
 8     {
 9         int[] aa=new int[10];
10         for (int i=0; i <2; i++) {
11             aa[i]+=5;
12             System.out.println(aa[i]);
13         }
14     }
15  }

 

Guess you like

Origin www.cnblogs.com/qsy0021/p/11291154.html