![subject](/tpl/images/cats/informatica.png)
Computers and Technology, 18.01.2021 14:00 Animallover100
Suppose that you are trying to write a program that produces the following output using loops. The program below is an attempt at a solution, but it contains at least four major errors. Identify and fix them all. Your solution must have a class constant. A constant must be declared as 'public static final' outside of any methods in your class.
1 3 5 7 9 11 13 15 17 19 21 1 3 5 7 9 11
public class BadNews {
public static int MAX_ODD = 21;
public static void writeOdds() {
// print each odd number
int count=0;
for ( count = 1; count <= (MAX_ODD - 2); count++) {
System. out. print(count + " ");
count = count + 1;
}
// print the last odd number
System. out. print(count);
System. out. println();
}
public static void main(String[] args) {
// write all odds up to 21
writeOdds();
// now, write all odds up to 11
MAX_ODD = 11;
writeOdds();
}
}
![ansver](/tpl/images/cats/User.png)
Answers: 3
![](/tpl/images/ask_question.png)
![](/tpl/images/ask_question_mob.png)
Another question on Computers and Technology
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 21.06.2019 22:00
Which one of the following would administrators use to connect to a remote server securely for administration? a. telnetb. secure file transfer protocol (sftp)c. secure copy (scp)d. secure shell (ssh)
Answers: 1
![question](/tpl/images/cats/informatica.png)
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 24.06.2019 14:30
Two students are discussing electricity that has a frequency of 60 hz. student a says that this type of electricity is referred to as ac. student b says that in this type of electricity, the electrons flow in only one direction. which of the following statements is correct? a. only student a is correct b. only student b is correct c. both of the two students are correct d. neither of the two students is correct
Answers: 1
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 24.06.2019 18:30
Jacking is a crime that takes place when a hacker misdirects url to a different site. the link itself looks safe, but the user is directed to an unsafe page
Answers: 1
You know the right answer?
Suppose that you are trying to write a program that produces the following output using loops. The p...
Questions
![question](/tpl/images/cats/fizika.png)
![question](/tpl/images/cats/istoriya.png)
History, 24.05.2021 19:30
![question](/tpl/images/cats/mat.png)
Mathematics, 24.05.2021 19:30
![question](/tpl/images/cats/mat.png)
Mathematics, 24.05.2021 19:30
![question](/tpl/images/cats/mat.png)
Mathematics, 24.05.2021 19:30
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/mat.png)
Mathematics, 24.05.2021 19:30
![question](/tpl/images/cats/mat.png)
Mathematics, 24.05.2021 19:30
![question](/tpl/images/cats/obshestvoznanie.png)
Social Studies, 24.05.2021 19:30
![question](/tpl/images/cats/istoriya.png)
History, 24.05.2021 19:30
![question](/tpl/images/cats/mat.png)
Mathematics, 24.05.2021 19:30
![question](/tpl/images/cats/fizika.png)
![question](/tpl/images/cats/mat.png)
Mathematics, 24.05.2021 19:30
![question](/tpl/images/cats/istoriya.png)
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/istoriya.png)
History, 24.05.2021 19:30
![question](/tpl/images/cats/geografiya.png)
![question](/tpl/images/cats/mat.png)
Mathematics, 24.05.2021 19:30