Skip to main content

Java Programs

 Q. Write a program to print first letters of each word in a string if it is a vowel.

 Explanation: Let us consider a string "Ellen is my cousin's friend"

 In the above string 'E' 'i' are first letters of string and it is vowel so it should print the two letters.

Program:  

import java.util.Scanner;

public class Main{

public static void main(String[] args) {

    Scanner sc=new Scanner(System.in);

    String st=sc.nextLine();

    String Words[]=st.split(" ");

    for(int i=0;i<Words.length;i++){

        String s=Words[i];

        s=s.toLowerCase();

     if(s.charAt(0)=='a'|| s.charAt(0)=='e'|| s.charAt(0)=='i'|| s.charAt(0)=='o'|| s.charAt(0)=='u'){

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

     }   

    }

}

}



Comments

Popular posts from this blog

TCS INTERVIEW EXPERIENCE [TR]

Questions In Technical Round-   1. Where are u from ? 2. About project. 3. Then she asked me About mini project. 4. Explain your mini project.  5. Some questions related to my mini project. 6 . OOPS Concepts. 7. In which languages you r good in.  8. How do u rate your self in that. 9.  Some basic questions from c like syntax of for loop n what is nested if else. 10. What are conditional statements.  11. Difference between call by value n call by reference 12. One question from Data Structures ( define Stack n it's operations )  13. As I have mentioned the workshops I have attended          they have asked me what did I learnt from those workshops n explain it.  14. Difference between c and python, c and c ++  15. Do you know SDLC ? 16. Explain any one model in SDLC.  17. Any certifications?  18. R u going to work at any location with in India? 19. Ok with night shifts?      ...

TCS INTERVIEW EXPERIENCE [HR]

Questions In HR Round -  1. Self introduction. 2. What do you know about TCS?  3. Who is the CEO of TCS ? 4. Tell me about your family background. 5. About   Relocation. 6. Tell me about your father. 7. What would you do if  I reject u ( I said I will try to find out why I was rejected n try to improve in those areas n again apply for the job in TCS)  9.  HR: What if I again reject u  [ This is just an example, elaborate it depending on the  job description ]    Me :  I have seen in job description that one should be a good team player n adaptive for this role , apart from my academics I'm a good team player n adaptive so I don't think I'll be rejected. HR: okay Ur documents will be verified before joining if we hire u. That's all... ALL THE BEST