 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Program for converting Alternate characters of a string to Upper Case.\\n
You can convert a character to upper case using the toUpperCase() method of the character class.
Example
Following program converts alternate characters of a string to Upper Case.
import java.util.Scanner; public class UpperCase {    public static void main(String[] args) {       Scanner sc = new Scanner(System.in);       System.out.println("Enter a string :");       String str = sc.nextLine();       str = str.toLowerCase();       char[] ch = str.toCharArray();       for(int i=0; i<ch.length; i=i+2){          ch[i] = Character.toUpperCase(ch[i]);       }       System.out.println(new String(ch));    } }  Output
Enter a string : hihowareyou HiHoWaReYoU
Advertisements
 