Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Robert Richardson   on Nov 19 In Java Category.

  
Question Answered By: Hayden Evans   on Nov 19

class Testing {
public static void main(String[] args) {
char c1 = 'a', c2;
c2 = (char) ( c1 - ('a' - 'A'));

String s1 = "abc", s2 = "";
for (int i=0; i<s1.length(); i++) {
s2 = s2 + (char) ( s1.charAt(i) - ('a' - 'A') );
}
System.out.println( c2 + " " + s2);
}
}
----------
do add other code  to check that the char you are converting
is between 'a' to 'z'.

Share: 

 

This Question has 1 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on how to make alphabets uppercase without using function Or get search suggestion and latest updates.


Tagged: