Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class ParaulesSenars {
- public static void main (String[] args) {
- Scanner lector = new Scanner(System.in);
- System.out.println("Escriu una frase de diverses paraules:");
- String frase = lector.nextLine();
- String[] arrayParaules = frase.split(" ");
- for(int i = 0; i < arrayParaules.length; i = i + 2) {
- System.out.print (arrayParaules[i] + " ");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement