Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void stworzPlik() {
- File plik = new File(nazwaPliku);
- boolean czyIstenieje = plik.exists();
- if (!czyIstenieje) {
- try {
- czyIstenieje = plik.createNewFile();
- } catch (IOException e) {
- System.out.println("nie udalo sie utworzyc pliku");
- }
- }
- if (czyIstenieje) {
- System.out.println("Pkik" + nazwaPliku + "istenieje lub zostal utworzony");
- }
- }
- public void zapisDoPliku(){
- try{
- PrintWriter writer=new PrintWriter(nazwaPliku);
- writer.printf("%s%n", "Macierz");
- writer.printf("%d%n", liczbaWierszy);
- writer.printf("%d%n", liczbaKolumn);
- for(int i=0; i<tab.length; i++){
- for(int j=0; j<tab[i].length; j++)
- writer.printf("%8.3d", tab[i][j]);
- }
- writer.printf("%n");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement