| 
 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectdemo.Merkit
public class Merkit
Ohjelmalla lasketaan montako kertaa mikäkin merkki esiintyy tiedostossa.
| Nested Class Summary | |
|---|---|
| static class | Merkit.EsiintymatLuokka joka laskee merkkien esiintymiä | 
| Constructor Summary | |
|---|---|
| Merkit() | |
| Method Summary | |
|---|---|
| static void | main(java.lang.String[] args)Lasketaan merkkien esiintymät tiedostossa. | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Constructor Detail | 
|---|
public Merkit()
| Method Detail | 
|---|
public static void main(java.lang.String[] args)
                 throws java.io.IOException
args - tiedoston nimi jos halutaan, muuten nimi kysytään
java.io.IOException
 #THROWS IOException
 #CLASSIMPORT
 #import java.io.*;
 #import fi.jyu.mit.ohj2.Suuntaaja;
 #import fi.jyu.mit.ohj2.VertaaTiedosto;
 Suuntaaja.StringOutput so = new Suuntaaja.StringOutput();
 VertaaTiedosto.kirjoitaTiedosto("koe.txt",
   "123456789012345678901234567890123456789012345678901234567890\n"+
   "Kissa istuu puussa\n"+
   "ja ihmettelee\n"+
   "mualiman menoa\n");
   
 Merkit.main(new String[]{"koe.txt"});
 
 String tulostus =
   "0a =   4   =   4 0 =   6 1 =   6 2 =   6 3 =   6 4 =   6 5 =   6 6 =   6\n" +
   " 7 =   6 8 =   6 9 =   6 K =   1 a =   6 e =   5 h =   1 i =   4 j =   1\n" +
   " l =   2 m =   4 n =   2 o =   1 p =   1 s =   5 t =   3 u =   5\n";
 so.ero(tulostus) === null;   
 so.palauta();   
 VertaaTiedosto.tuhoaTiedosto("koe.txt");
 | 
 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||