Computer Science, asked by vinaysaini3106, 5 months ago

write a program in java to input a character display next 5 characters​

Answers

Answered by akankshakamble6
1

Answer:

Hi,

it is a program that used to input a character and it also outputs that character

[code java]

import java.util.Scanner;

public class Main {

public static void main(String[] args) {

Scanner scanner = new Scanner(System.in);

System.out.println("Enter a character: ");

char c = scanner.next().charAt(0);

System.out.println("You have entered: "+c);

}

}

[/code]

you can use a Scanner to read from input (for a single character):

[code java]

Scanner scanner = new Scanner(System.in);

char c = scaner.next().charAt(0);

[/code]

You can either scan an entire line:

[code java]

Scanner s = new Scanner(System.in);

String str = s.nextLine();

[/code]

Thank you.

Answered by anuragmukherjee74
2

Answer:

public class no.

{

public static void main(ch a,b,c,d,e)

{

System.out.println(a);

System.out.println(b);

System.out.println(c);

System.out.println(d);

System.out.println(e);

}

}

HOPE THE ANSWER HELPS YOU...... PLEASE MARK ME AS BRAINLEAST......

HI... YOU PLS FOLLOW ME AS I AM ALSO AN ICSE STUDENT AND IS IN STD 9...

Similar questions