Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- main
- =======================================
- package Tester;
- import java.io.FileNotFoundException;
- import Cls.Phone;
- public class MainPhone {
- public static void main(String[] args) throws FileNotFoundException {
- ///final String FILE1 = "c:\\yana\\phone.txt";
- new Phone("0525774072", "yana").save();
- System.out.println("Done");
- }
- }
- cls
- ======================================
- package Cls;
- import java.io.File;
- import java.io.FileNotFoundException;
- import java.io.PrintWriter;
- public class Phone{
- private String cellNum;
- private String name;
- private final int SUMCHARGE = -1;
- private int lastPay=SUMCHARGE;
- private final File PHONE_BOOK=new File("c:\\yana\\phone.txt");
- public Phone(String cellNum, String name) {
- this.cellNum = cellNum;
- this.name = name;
- }
- public void save() throws FileNotFoundException {
- PrintWriter pw = new PrintWriter(PHONE_BOOK);
- pw.print("line number: " + cellNum + " owner: " + name + " last pay: "
- + lastPay);
- pw.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement