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 serializacja;
- import java.io.Externalizable;
- import java.io.IOException;
- import java.io.ObjectInput;
- import java.io.ObjectOutput;
- import java.io.Serializable;
- /**
- *
- * @author Piotr Zuber
- */
- public class Pracownik implements Serializable, Externalizable{
- private String Imie,Nazwisko;
- private int Wyplata;
- public Pracownik()
- {
- Imie="Andrzej";
- Nazwisko="Kowalski";
- Wyplata = 2500;
- }
- public Pracownik(String im,String nz,int w)
- {
- Imie=im;
- Nazwisko=nz;
- Wyplata =w;
- }
- public String getImie() {
- return Imie;
- }
- public String getNazwisko() {
- return Nazwisko;
- }
- public int getWyplata() {
- return Wyplata;
- }
- @Override
- public void writeExternal(ObjectOutput oo) throws IOException {
- oo.writeObject(Imie+"Dupa");
- // oo.writeObject("Dawid");
- oo.writeObject(Nazwisko);
- oo.writeObject(Wyplata);
- }
- @Override
- public void readExternal(ObjectInput oi) throws IOException, ClassNotFoundException {
- Imie = (String)oi.readObject();
- //String x = (String)oi.readObject();
- Nazwisko = (String)oi.readObject();
- Wyplata = (int)oi.readObject();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement