Advertisement
joseleonweb

Untitled

Aug 30th, 2019
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.50 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class ConcatenaText {
  4.  
  5.   public static final int NUM_FRASES = 2;
  6.  
  7.   public static void main (String[] args) {
  8.     Scanner lector = new Scanner(System.in);
  9.  
  10.     String novaFrase = "";
  11.     System.out.println("Escriu " + NUM_FRASES + " frases.");
  12.     System.out.println("Per acabar una frase, pitja la tecla de retorn.");
  13.     for (int i = 0; i < NUM_FRASES; i++) {
  14.       novaFrase = novaFrase + lector.nextLine();
  15.     }
  16.     System.out.println(novaFrase);
  17.  
  18.   }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement