Advertisement
Guest User

Untitled

a guest
Feb 24th, 2020
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.41 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package tablice2d2t;
  7.  
  8. /**
  9.  *
  10.  * @author uczen
  11.  */
  12. public class Tablice2d2t {
  13.  
  14.     /**
  15.      * @param args the command line arguments
  16.      */
  17.     public static void main(String[] args) {
  18.         // Definicja i deklaracja tablic 2D
  19.         //Dynamicznie:
  20.         //typ[][] nazwa Tablicy = new typ[liczbaWierszy][liczbaKolumn];
  21.        
  22.         String[][] sp = new String[5][12];
  23.         double [][]tpensji = new double[12][2];
  24.         double[][]gps = new double[36][2];
  25.         //uzupelnienie losowe
  26.         for (int i = 0; i < 36; i++)//wiersze
  27.         {
  28.             for (int j = 0; j < 2; j++)//kolumny
  29.             {
  30.                 gps[i][j]=Math.random()*500;
  31.             }
  32.         }
  33.        
  34.         //wyśweitlanie
  35.         System.out.println("x\ty");
  36.         for (int i = 0; i < 36; i++) {
  37.             System.out.println(gps[i][0]+"\t"+gps[i][1]);
  38.         }
  39.        
  40.         //tablice 2D statycznie
  41.         String []imie={"Zosia","Czesia","Gabrysia"};
  42.         String [][]tunlike={
  43.                     {"Skoła", "ttruskawki","meny","kawa"},
  44.                     {"pączki", "smietana","pań","aut"},
  45.                     {"psów","kotów","jaszczurów","żubrów"}
  46.                     };
  47.         }
  48.     }
  49.    
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement