aldes182

Untitled

Jan 16th, 2021 (edited)
527
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //RecordType1.Java
  2.  
  3. class RecordType1
  4. {
  5.     char[] Y;
  6.  
  7.     public RecordType1 (char[] OperandArray)
  8.     {
  9.         this.Y = OperandArray;
  10.     }
  11. }
  12.  
  13. //RecordType2.Java
  14.  
  15. class RecordType2
  16. {
  17.   RecordType1 W;
  18.   char[] Y;
  19.  
  20.   public RecordType2 (RecordType1 Operand1, char[] OperandArray)
  21.   {
  22.       this.Y = OperandArray;
  23.       this.W = Operand1;
  24.   }
  25. }
  26.  
  27.  
  28. //RecordMain.Java
  29.  
  30. public class RecordMain
  31. {
  32.     public static void main (String[] args)
  33.     {
  34.         char[] CollectionObject1 = {'e','f'};
  35.         char[] CollectionObject2 = {'c','d'};
  36.  
  37.         RecordType1 RecordObject1 = new RecordType1 (CollectionObject1);
  38.         RecordType2 X = new RecordType2 (RecordObject1, CollectionObject1);
  39.        
  40.         X.Y[0] = X.Y[1];
  41.         X.W.Y[0] = X.W.Y[1];
  42.  
  43.         System.out.println (X.Y[1]);
  44.         System.out.println (X.W.Y[0]);
  45.  
  46.         X.Y=CollectionObject2;
  47.         System.out.println(Arrays.toString(X.Y));
  48.  
  49.     }  
  50. }
  51.  
  52. //RecordMainRepetition.Java
  53.  
  54. public class RecordMainRepetition
  55. {
  56.     public static void main (String[] args)
  57.     {
  58.         int maxValue = 5;
  59.  
  60.        //Versi Pertama
  61.         for (int i = 1; i <= maxValue; i++)
  62.         {
  63.            System.out.println (i + "\t" + Math.log(i));
  64.         }
  65.  
  66.         //Versi Kedua
  67.         int[] Collection = new int[]{1,2,3,4,5};
  68.         for (int Subscript : Collection)
  69.         {
  70.            System.out.println (Collection[Subscript] + "\t" + Subscript);
  71.         }
  72.  
  73.         //Versi Kedua
  74.         String[] CollectionString = new String[] {"a","b","c","d","e"};
  75.         for (String SubscriptValue : CollectionString)
  76.         {
  77.            System.out.println (CollectionString + "\t" + SubscriptValue);
  78.         }
  79.     }  
  80. }
  81.  
RAW Paste Data