Question: the two codes have an error and I cant figure out where. First one public class Program { public static void main(String[] args) { int

the two codes have an error and I cant figure out where.

First one

public class Program

{

public static void main(String[] args) {

int i, j = 1, k = 0;

String alphabet = "abcdefghijklmnopqrstuvwxyz";

i = alphabet.length();

while (i>0){

j=(i-(i-j));

System.ou.println(alphabet.charAt(k)+" is the number "+j"letter in the alphabet");

k++;

j++;

i--;

}

}

}

Second one

char [] alphabet = {a,b,c,d,e,f,g,h,I,j,k,l,m,n,o,p,a,r,s,t,u,v,w,x,y,z};

for (int i = 0; i < alphabet.length; i++)

{

System.out.println(alphabet[i] + is the number + (i+1) + letter in the alphabet );

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!