Help with this program please!!! 1. Fill an array with words and Unicode charact
ID: 3761401 • Letter: H
Question
Help with this program please!!!1. Fill an array with words and Unicode characters. The words are: friendship loyalty honor country The Unicode characters are "A","B","C" 2. Declare this array: int intArr[] = {30,20,5,12,55}; Sort the array (lowest to highest) Help with this program please!!!
1. Fill an array with words and Unicode characters. The words are: friendship loyalty honor country The Unicode characters are "A","B","C" 2. Declare this array: int intArr[] = {30,20,5,12,55}; Sort the array (lowest to highest) Help with this program please!!!
1. Fill an array with words and Unicode characters. The words are: friendship loyalty honor country The Unicode characters are "A","B","C" 2. Declare this array: int intArr[] = {30,20,5,12,55}; Sort the array (lowest to highest) Help with this program please!!!
1. Fill an array with words and Unicode characters. The words are: friendship loyalty honor country The Unicode characters are "A","B","C" 2. Declare this array: int intArr[] = {30,20,5,12,55}; Sort the array (lowest to highest)
Explanation / Answer
1. Fill an array with words and Unicode characters.
Method1: To enter from user:
Method2: To declare variables within the program:
2. Declare this array: int intArr[] = {30,20,5,12,55}; Sort the array (lowest to highest)
public class sorting {
public static void main(String arg[])throws Exception{
int j[]={30, 20, 5, 12, 55};
for(int s=0;s<=j.length-1;s++){
for(int k=0;k<=j.length-2;k++){
if(j[k]>j[k+1]){
int temp=0;
temp=j[k];
j[k]=j[k+1];
j[k+1]=temp;
}
}
}
for(int s=0;s<=j.length-1;s++){
System.out.println(j[s]);
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.