Hi guys,
New in Java so i have a lot of questions. Beginning with this one.
I'm trying to retrieve the next character of a character. A->B, B->C, ...., Z->A
using this code:
import java.util.*; import java.text.*; public class Letter { private char letter; public Letter() { // initialise instance variables letter = 'A'; } // Method public char getLetter() { return letter; } public char next(){ int intChar; intChar = this.letter.charCodeAt(); } }
The idea is (example) to convert 'A' to ASCII code (65), increase it (66) and convert this to 'B'
I know char is a primitive type, not an object. I tried several things with Character. No succes. What is going wrong.
The compiler complains about .charCodeAt: char cannot be dereferenced