Java:
I am receiving this error message when I compile on Java: The
type java.lang.CharSequence cannot be resolved. It is indirectly
referenced from required .class files
Here is the code:
public class EncryptorOne implements Encryptor {
int key;
public EncryptorOne(int key) {
this.key = key;
}
public String encrypt(String plainText) {
StringBuffer
encrypted = new StringBuffer();
for (char letter :
plainText.toCharArray()) {
if (Character.isLetter(letter)) {
int shiftedLetter = letter + key;
char shiftedCharacter = (char) shiftedLetter;
if (shiftedLetter > 'z') {
shiftedLetter = 'a' + shiftedLetter - 'z'-1;
shiftedCharacter = (char) shiftedLetter;
}
encrypted.append(shiftedCharacter); //this is the error
line
} else {
encrypted.append(letter);
}
}
return
encrypted.toString();
}
public int getKey() {
return key;
}
public void setKey(int key) {
this.key = key;
}
}
Java: I am receiving this error message when I compile on Java: The type java.lang.CharSequence cannot be resolved. It i
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
Java: I am receiving this error message when I compile on Java: The type java.lang.CharSequence cannot be resolved. It i
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!