Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Imenik extends Kontakt {
- File imenik_txt = new File("C:\\Users\\Gol D. Roger\\Desktop\\Imenik.txt");
- ArrayList<String> podaci_lista = new ArrayList<String>();
- public void dodajKontakt() throws IOException {
- Kontakt k = new Kontakt();
- Scanner s = new Scanner(System.in);
- System.out.println("Unesite ime novog kontakta: ");
- k.setIme("IME: " + s.nextLine() + "|");
- System.out.println("Unesite prezime novog kontakta: ");
- k.setPrezime("PREZIME: " + s.nextLine() + "|");
- System.out.println("Unesite broj novog kontakta: ");
- k.setBrojTelefona("BROJ: " + s.nextLine() + "|");
- System.out.println("Unesite e-mail novog kontakta: ");
- k.setEmail("E-MAIL: " + s.nextLine());
- String o_string = k.toString();
- podaci_lista.add(o_string);
- FileWriter fw = new FileWriter(imenik_txt, true);
- BufferedWriter bw = new BufferedWriter(fw);
- for(String a : podaci_lista){
- bw.write(a);
- }
- bw.newLine();
- bw.close();
- fw.close();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement