Computer Applications
Write a program in Java to input a character. Display next 5 characters.
Java
Java Library Classes
105 Likes
Answer
import java.util.Scanner;
public class KboatFiveChars
{
public static void main(String args[]) {
Scanner in = new Scanner(System.in);
System.out.print("Enter a character: ");
char ch = in.next().charAt(0);
System.out.println("Next 5 characters from "
+ ch + " are:");
for (int i = 1; i <= 5; i++) {
System.out.println(++ch);
}
}
}
Variable Description Table
Program Explanation
Output


Answered By
41 Likes
Related Questions
Write the prototype of a function check which takes an integer as an argument and returns a character.
Write a program in Java to input a character. Find and display the next 10th character in the ASCII table.
Write a program in Java to generate all the alternate letters in the range of letters from A to Z.
Write a program to input a set of 20 letters. Convert each letter into upper case. Find and display the number of vowels and number of consonants present in the set of given letters.