Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void main(String[] args) {
- char[] tab = {'a', 'b', 'c', 'e', 'f'};
- for (int i = 0; i < tab.length; i++) {
- if (i > 0) {
- System.out.print(tab[i - 1]);
- } else {
- System.out.print(tab[tab.length - 1]);
- }
- System.out.print(tab[i]);
- if (i < tab.length - 1) {
- System.out.print(tab[i + 1]);
- } else {
- System.out.print(tab[0]);
- }
- System.out.println();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement