Skip to content

Commit e1c940b

Browse files
authored
sound of their wings was as the sound of chariots
And they had breastplates, as it were breastplates of iron; and the sound of their wings was as the sound of chariots of many horses running to battle. (Revelation 9:9)
1 parent 69c22bc commit e1c940b

1 file changed

Lines changed: 49 additions & 0 deletions

File tree

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
2+
//And they had breastplates, as it were breastplates of iron;
3+
//and the sound of their wings was as the sound of chariots of many horses running to battle. (Revelation 9:9)
4+
5+
package com.javarush.task.task35.task3512;
6+
7+
public class Generator<T> {
8+
9+
Class<T> tClass;
10+
11+
public Generator(Class<T> tClass) {
12+
this.tClass = tClass;
13+
}
14+
15+
T newInstance() {
16+
try {
17+
return (T) tClass.newInstance();
18+
}catch (Exception e) {}
19+
return null;
20+
}
21+
}
22+
23+
/*
24+
Генератор объектов
25+
26+
Разберись с текущими классами.
27+
28+
Метод newInstance класса Generator должен создавать Event для каждого нового вызова, однако сейчас компилятор ругается на синтаксис.
29+
30+
Переделай класс Generator так, что бы конструкция стала рабочей.
31+
32+
33+
34+
Подсказка: Для создания объекта потребуется использовать метод Class<T>.newInstance().
35+
36+
37+
38+
39+
40+
Требования:
41+
42+
1. Класс Generator должен быть параметризован типом Т.
43+
44+
2. Класс Generator должен иметь поле типа Class, которое параметризовано типом Т.
45+
46+
3. Класс Generator должен иметь конструктор, который инициализирует поле типа Class.
47+
48+
4. Метод newInstance в классе Generator должен создавать и возвращать объект типа Т.
49+
*/

0 commit comments

Comments
 (0)