Take FREE!! Online Mettl Mock Test to Crack TechM and Other Companies Written Exams.
Get Off-Campus Placement Jobs Info !!!
TCS NQT Technical and Managerial Round Interview Questions

Program Discussion :: Strings

Home > Programs > Strings

39 / 59

Write a function which returns a sub string in the string 'Sigma' (character given) which starts with 'Alpha' and ends with 'Theta'.

Answer:

import java.util.*;

public class Substring
{
    public static void main(String args[])
    {
        String str="";
        Scanner sc=new Scanner(System.in);
        System.out.println("Enter the string: ");
        String sigma=sc.nextLine();
        int len=sigma.length();
        System.out.println("Enter the beginIndex: ");
        int alpha=sc.nextInt();
        System.out.println("Enter the endIndex: ");
        int theta=sc.nextInt();
        if((alpha>=0 && theta

Asked In :: Virtusa

Post Your Answer Here:

Language:

Post Your Reply Here: