Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
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
Java string case change sample code examples.
You can change the cases using the toUpperCase() and toLowerCase() methods of the String class.
Example
public class Sample {
public static void main(String args[]){
String str = "Hello how are you";
String strUpper = str.toUpperCase();
System.out.println("Lower to upper : "+strUpper);
String strLower = str.toLowerCase();
System.out.println("Upper to lower : "+strLower);
}
}
Output
Lower to upper : HELLO HOW ARE YOU Upper to lower : hello how are you
Advertisements