0

this should be the output:
A b C d E f G h I j K l M n O p Q r S t U v W x Y z

heres what i ve done so far:

class za
{
public static void main(String[]args)
{
String x="abcdefghijklmnopqrstuvwxyz";
int ctr;
for(ctr=1;ctr<=x.length()-1;ctr++)
{
if(ctr%2)
System.out.print(Character.toUpperCase(x.charAt(ctr)));
}
}
}

4
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by stultuske
0

if you want to find a particular character and then replace a particular position first you should convert the string to char array then iterate over the character array and change the character you want to

Edited by zeroliken: n/a

0

here is modified code

class za
{
public static void main(String[]args)
{
String x="abcdefghijklmnopqrstuvwxyz";
int ctr;
for(ctr=0;ctr<=x.length()-1;ctr++)
{
if(ctr%2==1)
System.out.print(x.charAt(ctr)+" ");
else
System.out.print(Character.toUpperCase(x.charAt(ctr))+" ");
}
}
}

Edited by rushikesh jadha: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.