sergAccount

Untitled

Aug 30th, 2020
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.94 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 com.spec;
  7.  
  8. import com.spec.model.Holder;
  9. import com.spec.model.OldHolder;
  10.  
  11. public class Main {
  12.    
  13.     public static void main(String[] args) {
  14.         //
  15.         OldHolder h = new OldHolder(10);
  16.         h.setI(20);        
  17.         System.out.println("g.getI=" + h.getI());
  18.        
  19.         //Holder h2 = new Holder(10.20);
  20.        
  21.         // переменная h2 типа Holder<String>                
  22.         //
  23.         Holder<String> h2 = new Holder<>("HELLO");
  24.         String value = h2.getI();
  25.         System.out.println("value=" + value);        
  26.         h2.setI("JAVA");
  27.        
  28.         Holder<Integer> h3 = new Holder<>(20);  
  29.         Integer i = h3.getI();
  30.         h3.setI(20);                        
  31.     }    
  32. }
  33.  
Add Comment
Please, Sign In to add comment