Тёмный

Write a java program to sort names in an array? 

Learn With KrishnaSandeep
Подписаться 172 тыс.
Просмотров 39 тыс.
50% 1

Опубликовано:

 

27 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 18   
@sushant3530
@sushant3530 2 года назад
source code: String name[]={"BANANA","APPLE","PINEAPPLE","MANGO","KIWI"}; int n = name.length; //array length=5 String tmp; for(int i=0; i
@sarahcharlotte6681
@sarahcharlotte6681 Год назад
Ur teaching awsome.Subscribed to ur channel bro.
@passionfruit712
@passionfruit712 Год назад
Why do you creat 2 objects of Scanner can't we just use 1 ?
@sainath2983
@sainath2983 5 месяцев назад
public class Program { static void Main(string[] args) { string[] str = {"Banana,Grapes,Apple" }; var splitstring = str.Select(x=> x.Split(",")).ToArray(); string[] result = splitstring[0].ToArray(); string temp = string.Empty; for(int i =0;i< result.Length; i++) { for(int j =i +1;j< result.Length; j++) { if (result[i].CompareTo(result[j]) > 0) { temp = result[j]; result[j] = result[i]; result[i] = temp; } } } foreach(var x in result) { Console.WriteLine(x); } } }
@Vijai777
@Vijai777 2 года назад
Explanation superb...
@sushant3530
@sushant3530 2 года назад
amazing explanation sir
@Storyonmountains
@Storyonmountains Год назад
Nyc explanation ❤
@springhibernatetutes
@springhibernatetutes Год назад
Thanks 🙂
@devilox1166
@devilox1166 Год назад
Why do you create two objects of scanner?
@passionfruit712
@passionfruit712 Год назад
Same question
@madhavkiagya
@madhavkiagya Год назад
if you do not create a new object, it will take only 2 names in input, i.e. 1st i/p banana and second i/p grapes can be entered but can't enter 3rd i/p apple
@balakrishnan-pe9tl
@balakrishnan-pe9tl Год назад
If I give apple a as small and Banana B as capital and Grapes G as capital means the out put will be Banana Grapes apple Even if we gave the input in capital also it should come in alphabetical order so pls write a program for that
@sharonsam5687
@sharonsam5687 Год назад
for(int i=0;i
@balakrishnan-pe9tl
@balakrishnan-pe9tl Год назад
@@sharonsam5687 hi. This is normal sorting program. If gave names ( Bala ,anbu,Ram ) like this also I want in alphabetically but Its not coming it's coming Bala,Ram,anbu.
@medamvinodkumarreddy6478
@medamvinodkumarreddy6478 Год назад
Just do one thing. While sending the name to comapareTo method use toUpperCase() or toLowerCase() methods.
@passionfruit712
@passionfruit712 Год назад
Why do you creat 2 objects of Scanner can't we just use 1 ?
@passionfruit712
@passionfruit712 Год назад
Why do you creat 2 objects of Scanner can't we just use 1 ?
Далее
DEMONS ARE ATTACKING BRAWL STARS!!!
09:08
Просмотров 13 млн
MAGIC TIME ​⁠@Whoispelagheya
00:28
Просмотров 5 млн
Design a Dynamic Array (Resizable Array)
11:17
Просмотров 39 тыс.
9  Write a Java program to sort the string array
12:10
Insertion Sort Algorithm With Java Program by Deepak
20:46
Java arrays 🚗
6:26
Просмотров 209 тыс.
HashMap Java Tutorial #50
11:42
Просмотров 413 тыс.
ArrayList in Java Tutorial #36
5:50
Просмотров 535 тыс.