Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package com.mycompany.ex22;
- public class Main {
- //
- public static void main(String[] args) {
- // Обобщения (generics) (обобщенные классы (универсальные классы))
- // <T> - синтаксис, где T - тип
- // Holder<String> - используем Holder который хранит String
- Holder<String> h1 = new Holder<>();
- String s = h1.getValue();
- //
- Holder<Person> h2 = new Holder<>();
- Person p = h2.getValue();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement