Advertisement
Paarzivall

Untitled

Mar 13th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.46 KB | None | 0 0
  1. import java.io.File;
  2. import java.io.FileNotFoundException;
  3. import java.util.Scanner;
  4.  
  5. public class kolodL2_B {
  6.  
  7.     public static void main(String[] args) throws FileNotFoundException {
  8.         File inFile = new File("B.dat");
  9.        
  10.         Scanner sc = new Scanner(inFile);
  11.         int suma = 0;
  12.         while(sc.hasNext()) {
  13.             String data = sc.nextLine();
  14.             if(data.contains("!")) {
  15.                 suma += 1;
  16.             }
  17.         }
  18.         System.out.println("Linii z wykrzyknikami jest: "+ suma);
  19.     }
  20.  
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement