Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Java
Posted by: ulkir
Added: Jul 2, 2020 5:51 PM
Modified: Jul 12, 2020 5:07 PM
Views: 195
  1.     //bunun sonucu 4 2 3 1  seklinde sonuc verir, 1. index in 1. elemani once sonra 1. indexin 0. elemani sonrada 0. index in 1. elemani sonrada 0. index in 0. eleamani
  2.     public static void main(String[] args) {
  3.  
  4.         int[][] n = {{1, 3}, {2, 4, 5, 7, 8, 9}}; //sorudaki array ise {1,3},{2,4} => 4 2 3 1
  5.         for (int i = n.length - 1; i >= 0; i--) {
  6.             for (int j = n[i].length - 1; j >= 0; j--) {
  7.                 System.out.print(n[i][j]);
  8.             }
  9.         }
  10.     }
  11.  
  12.  
  13.  
  14. //Single reverse,  2 4 1 3   //once 1. indexin 0. elemanindan basliyor sonra 1. nin 1 ini yazdiriyor
  15. //sonra 0. index in 0. elemani sonra da 0. index in 1. elemani
  16.  
  17.     public static void main(String[] args) {
  18.         int n[][] = {{1, 3}, {2, 4}};
  19.         for (int i = n.length - 1; i >= 0; i--) {
  20.             for (int y : n[i]) {
  21.                 System.out.print(y);
  22.             }
  23.         }
  24.  
  25.         //Defining an Array
  26. public static void main(String[] args) {
  27.         int array[] =new int [3];       //1. yol                       
  28.         array[0]=1;
  29.         array[1]=2;
  30.         array[2]=3;
  31.  
  32.         //2. yol
  33.                 int array2[]=new int [] {1,2,3};
  34.  
  35.         //3. yol
  36.                 int array3[];
  37.                 array3 = new int [3];
  38. }
  39.        
  40.