Computer Science, asked by ishika4833, 10 months ago

wap in java to enter a string and display the characters in individual lines​

Answers

Answered by Anonymous
1

Explanation:

import java.util.*;

class Char_disp

{

public static void main(String args[])

{

Scanner sc=new Scanner(System.in());

System.out.println("enter a string");

String s=sc.nextLine();

int l=s.length();

for(int i=0;i<l;i++)

System. out.println(s. charAt(i));

}

}

Answered by Oreki
0

import java.util.Scanner;

public class StringManipulation {

public static void main(String[ ] args) {

// Accepting a string and converting it into a character Array.

System.out.print("Enter a string - ");

char[ ] charArray = new Scanner(System.in).nextLine( ).toCharArray( );

// Printing on separate lines.

for (char letter : charArray)

System.out.println(letter);

}

}

Similar questions