Monday, 30 November 2020

Write a Program in Java to accept a Word Or Sentence and print the Second letter.

 import java.util.*;

 class Number

 {

     public static void main(String args[])

     {

         Scanner in=new Scanner(System.in);

         String s;

         System.out.println("Enter a Word or Sentence");

         s=in.nextLine();

         System.out.println("The Second Digit: "+s.charAt(1));

     }

 }

No comments:

Post a Comment

Java Program to count the total number of characters in a string

 //Java Program to count the total number of characters in a string import java.util.*; public class CountChars {     public static void mai...