Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions