// i don\'t understand why this program continues running. It doesnot stop. What
ID: 3615605 • Letter: #
Question
// i don't understand why this program continues running. It doesnot stop. What maybe wrong with it ?import javax.swing.*;
public class ArrayDemo9 // Compare arrays
{
public static void main ( String [] args )
{
int Leornard []= {80,99,100,0};
int Nyasha [] ={80,99,100,1};
while ( Leornard.length ==Nyasha.length)
{
boolean equal = false;
for ( intindex=0;index<4;index++)
{
if (Leornard[index]==Nyasha[index])
{
equal = true;
System.out.println("You are smart");
}
else
{
equal = false;
System.out.println("It is not a match");
}
}
}
}
}}
Explanation / Answer
please rate - thanks Is this what you are trying to do. say you are smart if all elements are equal, and it is not a matchif any are different import javax.swing.*; public class ArrayDemo9 // Compare arrays { public static void main ( String [] args ) { int Leornard []= {80,99,100,0}; int Nyasha [] ={80,99,100,1}; boolean equal =true; int index=0; while ( indexRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.