How to input character in programming


////This program is about how to input character using java...........
///Here  "InputCharacte" is the class name..............

import java.util.Scanner;

public class InputCharacter {

    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
       
        char ch;
       
        ch=sc.nextLine().charAt(0);
       
        System.out.println(ch);
    }

}
/////------------------------Input--------------------
///R
//--------------------------Output----------------------
///R

No comments:

Post a Comment