smgr

Untitled

Oct 26th, 2012
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.51 KB | None | 0 0
  1. import java.util.*;
  2. import java.io.*;
  3.  
  4. public class elso {
  5.     public static void main(String [] args){
  6.        
  7.         Scanner bill = new Scanner (System.in);
  8.        
  9.         System.out.println("Mi legyen a szó?");
  10.         String word = bill.nextLine();
  11.         System.out.println("Hányszor akarod kiíratni?");
  12.         int n = bill.nextInt();
  13.  
  14.        
  15.         try{
  16.             PrintWriter kimenet = new PrintWriter(new FileWriter("elso.txt"));
  17.             for(int i=0; i<=n; i++)
  18.                 kimenet.println(word + " ");
  19.             kimenet.close();
  20.         } catch(IOException e){}
  21.        
  22.        
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment