esoe 2 years ago
parent
commit
680f55b118
  1. 2
      book/src/main/java/ru/molokoin/Book.java
  2. BIN
      book/target/classes/ru/molokoin/Book.class
  3. 7
      practice/src/main/java/ru/molokoin/App.java
  4. 5
      practice/src/main/java/ru/molokoin/Employe.java
  5. 9
      practice/src/main/java/ru/molokoin/MilitarySpeciality.java
  6. 27
      practice/src/main/java/ru/molokoin/Person.java
  7. 16
      practice/src/main/java/ru/molokoin/Soldier.java
  8. BIN
      practice/target/classes/ru/molokoin/App.class
  9. BIN
      practice/target/classes/ru/molokoin/Employe.class
  10. BIN
      practice/target/classes/ru/molokoin/MilitarySpeciality.class
  11. BIN
      practice/target/classes/ru/molokoin/Person.class
  12. BIN
      practice/target/classes/ru/molokoin/Soldier.class

2
book/src/main/java/ru/molokoin/Book.java

@ -98,7 +98,7 @@ public class Book {
throw new NullPointerException("в случае, если массив authors еще не создан и писать нового автора некуда, создаем пустой массив, пишем в него данные нового автора ..."); throw new NullPointerException("в случае, если массив authors еще не создан и писать нового автора некуда, создаем пустой массив, пишем в него данные нового автора ...");
} catch (NullPointerException e) { } catch (NullPointerException e) {
//e.printStackTrace(); //e.printStackTrace();
System.out.println(e); System.out.println(e.getMessage());
result = new String[1]; result = new String[1];
result[0] = author; result[0] = author;
setAuthors(result); setAuthors(result);

BIN
book/target/classes/ru/molokoin/Book.class

Binary file not shown.

7
practice/src/main/java/ru/molokoin/App.java

@ -1,6 +1,11 @@
package ru.molokoin; package ru.molokoin;
public class App { public class App {
public static void main(String[] args) { public static void main(String[] args) {
System.out.println("qq"); //int[] array = {10, 2, 120,324,8,0};
Person[] array = new Person[2];
array[0] = new Person("Ivan", "Ivanov");
array[1] = new Soldier("Aleksey", "Alekseev", MilitarySpeciality.GUNLAYER);
array[1].toString();
} }
} }

5
practice/src/main/java/ru/molokoin/Employe.java

@ -0,0 +1,5 @@
package ru.molokoin;
public class Employe {
}

9
practice/src/main/java/ru/molokoin/MilitarySpeciality.java

@ -0,0 +1,9 @@
package ru.molokoin;
public enum MilitarySpeciality {
RADIOOPERATOR,
TANKMAN,
GUNLAYER,
DRIVER;
}

27
practice/src/main/java/ru/molokoin/Person.java

@ -0,0 +1,27 @@
package ru.molokoin;
public class Person {
private String firstname;
private String lastname;
public Person(String firstname, String lastname){
setFirstname(firstname);
setLastname(lastname);
}
public String getFirstname() {
return firstname;
}
public void setFirstname(String firstname) {
this.firstname = firstname;
}
public String getLastname() {
return lastname;
}
public void setLastname(String lastname) {
this.lastname = lastname;
}
@Override
public String toString(){
return "firstname: " + getFirstname() + " : " + "Lastname: " + getLastname();
}
}

16
practice/src/main/java/ru/molokoin/Soldier.java

@ -0,0 +1,16 @@
package ru.molokoin;
public class Soldier extends Person{
private MilitarySpeciality militarySpeciality;
public Soldier(String firstname, String lastname, MilitarySpeciality militarySpeciality){
super(firstname, lastname);
setMilitarySpeciality(militarySpeciality);
}
public MilitarySpeciality getMilitarySpeciality() {
return militarySpeciality;
}
public void setMilitarySpeciality(MilitarySpeciality militarySpeciality) {
this.militarySpeciality = militarySpeciality;
}
}

BIN
practice/target/classes/ru/molokoin/App.class

Binary file not shown.

BIN
practice/target/classes/ru/molokoin/Employe.class

Binary file not shown.

BIN
practice/target/classes/ru/molokoin/MilitarySpeciality.class

Binary file not shown.

BIN
practice/target/classes/ru/molokoin/Person.class

Binary file not shown.

BIN
practice/target/classes/ru/molokoin/Soldier.class

Binary file not shown.
Loading…
Cancel
Save