next up previous
Next: The class StringTokenizer Up: Unit 06 Previous: The class EncryptedText: realization

The class EncryptedText: example of a client

We realize the class ClientEncryptedText, which contains a method main that uses the class EncryptedText:

public class ClientEncryptedText {
  public static void main(String[] args) {
    EncryptedText t = new EncryptedText("Nel mezzo del cammin di ...", 10);
    System.out.println(t.getEncryptedText());
    System.out.println(t.getDecryptedText(10));
    t.setKey(10,20);
    System.out.println(t.getDecryptedText(10));
    System.out.println(t.getDecryptedText(20));
  }
}

The output of the program is the following:

Xov*wo??y*nov*mkwwsx*ns*888
Nel mezzo del cammin di ...
null
Nel mezzo del cammin di ...


next up previous
Next: The class StringTokenizer Up: Unit 06 Previous: The class EncryptedText: realization