-3

Write java code to convert all the lower-case letter present in array to upper case. Hint: Unicode value of ‘A’ is 65 and ‘a’ i

char [] arr ={‘a’,’b’,’C’,’e’,’D’,’G’,’l’,’m’,’C’,’Q’};

10/19/2019 5:31:34 AM

Hammad Hasan

8 Answers

New Answer

+6

Can you show your own attempts?

+5

Is this a challenge? If yes, please don't post it here.

+5

So if A= 65 a = 97 The diffrence is 32 this means that anything greater or equal to 97 must be a lowercase letter and will need 32 subtracted from it Try and make this work for you everything you need is above 👍

+5

Hammad Hasan Errors are exactly why we have to look at your attempts, and correct them from there. I can give you the complete solution, but you won't learn anything from it.

+3

Hammad Hasan That's not too bad. Try and tweak this to your preference. import java.util.Arrays; public class Lotouper { public static void main(String[] args) { char a[]={'a','b','D','e','F','g'}; for(int i=0; i<a.length;i++) if(a[i]>='a'&&a[i]<='z') a[i] = (char)(a[i]-32); System.out.println(Arrays.toString(a)); } }

+1

Its not challagne i need help to solve this

+1

package javaLoTUper; public class Lotouper { public static void main(String[] args) { int i; char ch; char a[]={'a','b','D','e','F','g'}; for(i=0; i<=a.length;i++){ if(a[i]>'a'&&a[i]<'z') { ch = a[i]-32; } } System.out.println("conversion is" + ch); } }

0

Hatsy Rei i try but not it has too many errors Kundly send me a logic