David Rolfe
David Rolfe

Reputation: 163

Why can't I call my method in my class

So the main method in my class looks like this:

public static void main(String[] args) {
    String text = "stuff";
    VigenereCipher t = new VigenereCipher(text);
    t.stringToIntArray(text);
    VigenereCipher s = new VigenereCipher(text);
    s.intArrayToString(t);

The problem is in the first method it takes a string and converts it to an int[] however the problem is when I try to call the second method (which converts the int[] back to a string) it says that t is a VigenereCipher and not an int[]. So how do I call the method in my class so that t is an int[] and not a VigenereCipher object?

Upvotes: 0

Views: 292

Answers (1)

Robin Krahl
Robin Krahl

Reputation: 5308

You have to pass the int[] returned by the stringToIntArray method, not the VigenereCipher object. For example:

String text = "stuff";
VigenereCipher t = new VigenereCipher(text);
int[] intArray = t.stringToIntArray(text);
VigenereCipher s = new VigenereCipher(text);
s.intArrayToString(intArray);

But I’m not sure if this does what you want.

Upvotes: 3

Related Questions