tag:blogger.com,1999:blog-8329261868133014079.post5648297651656403259..comments2023-11-12T15:20:28.392+05:30Comments on Simple And Advanced Java Programs: Bubble SortLionelhttp://www.blogger.com/profile/11329883633967646018noreply@blogger.comBlogger6125tag:blogger.com,1999:blog-8329261868133014079.post-43308129907870785302010-03-15T12:35:23.355+05:302010-03-15T12:35:23.355+05:30hi.. i tried using your code but im prompted w/ an...hi.. i tried using your code but im prompted w/ an error msgs after inputting the 2nd integer.. need your help pls.. :(<br /><br />--------------------Configuration: --------------------<br />Program to demonstrate bubble sort<br />Enter the number of elements to be entered <10<br />2<br />Enter the numbers to be sorted<br />5<br />4<br />Exception in thread "main" java.lang.NumberFormatException: For input string: ""<br /> at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)<br /> at java.lang.Integer.parseInt(Integer.java:470)<br /> at java.lang.Integer.parseInt(Integer.java:499)<br /> at Bubble.main(Bubble.java:17)<br /><br />Process completed.Unknownhttps://www.blogger.com/profile/15138856174587647478noreply@blogger.comtag:blogger.com,1999:blog-8329261868133014079.post-87002380510786689442010-03-15T12:02:59.418+05:302010-03-15T12:02:59.418+05:30hi sir.. i tried to copy and paste your code but a...hi sir.. i tried to copy and paste your code but after inputting the 2nd number, i gives me some error msgs...:<br /><br /><br />--------------------Configuration: --------------------<br />Program to demonstrate bubble sort<br />Enter the number of elements to be entered <10<br />2<br />Enter the numbers to be sorted<br />5<br />6<br />Exception in thread "main" java.lang.NumberFormatException: For input string: ""<br /> at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)<br /> at java.lang.Integer.parseInt(Integer.java:470)<br /> at java.lang.Integer.parseInt(Integer.java:499)<br /> at Bubble.main(Bubble.java:16)<br /><br />Process completed.Unknownhttps://www.blogger.com/profile/15138856174587647478noreply@blogger.comtag:blogger.com,1999:blog-8329261868133014079.post-4722184095218286242008-10-18T22:43:00.000+05:302008-10-18T22:43:00.000+05:30yr welcome .....by d way dis is my blog ....the pe...yr welcome .....<BR/><BR/>by d way dis is my blog ....<BR/>the person whom u r referring as sir is me.Lionelhttps://www.blogger.com/profile/11329883633967646018noreply@blogger.comtag:blogger.com,1999:blog-8329261868133014079.post-69803603924751707202008-10-16T19:26:00.000+05:302008-10-16T19:26:00.000+05:30thank you for the sample code sir!!.. and also to ...thank you for the sample code sir!!.. and also to lionel for the comments, you know what?, i can't really understand the logic of using array... <BR/>with this sample, i was able to understand the relationship of array with one another,...<BR/>Please continue it......<BR/>Thank you very much!!!!Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8329261868133014079.post-80651520270528901792008-10-12T13:58:00.000+05:302008-10-12T13:58:00.000+05:30yes it is possible .....for decending the logic wi...yes it is possible .....<BR/><BR/>for decending the logic will be :<BR/><BR/>for(int i=0;i< num;i++)<BR/>{<BR/>for(int j=i+1;j< num;j++)<BR/>{<BR/>if(arr[i]< arr[j])<BR/>{<BR/>int temp=arr[i];<BR/>arr[i]=arr[j];<BR/>arr[j]=temp;<BR/>}<BR/>}<BR/>}<BR/><BR/>you can print a menu and ask the user to enter an option and select either ascending or decending ...Lionelhttps://www.blogger.com/profile/11329883633967646018noreply@blogger.comtag:blogger.com,1999:blog-8329261868133014079.post-17477359477884118092008-10-09T19:11:00.000+05:302008-10-09T19:11:00.000+05:30hi sir...as i study your code...it seems that it c...hi sir...<BR/>as i study your code...<BR/>it seems that it can only sort the given numbers ascending...<BR/>how about descending??will it be posible?<BR/>and one thing more...<BR/>what if you put a part where the user is asked whether to sort the numbers ascending or descending, will it be posible?Anonymousnoreply@blogger.com