Advertisement
sergAccount

Untitled

Feb 14th, 2021
597
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.73 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.mycompany.ja11;
  7.  
  8. /**
  9.  *
  10.  * @author Admin
  11.  */
  12. public class Main {
  13.    
  14.     public static void main(String[] args) {
  15.        
  16.         // Holder<T> h;
  17.          
  18.         Holder<String> h1;
  19.         Holder<Integer> h2;
  20.         // ..
  21.         Holder<Person> h3;
  22.        
  23.         // создаем объект типа Holder
  24.         Holder<Person> h4 = new Holder<>(new Person());
  25.         Person p1 = h4.getObj();
  26.        
  27.         Holder<String> h5 = new Holder<>();
  28.         String p5 = h5.getObj();
  29.        
  30.     }
  31.  
  32. }
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement