Add to Favorites    Make Home Page 42374 Online  
 Language Categories  
 Our Services  

Home » Java Home » Beginners / Lab Assignments Home » Suso's Java

A D V E R T I S E M E N T

Search Projects & Source Codes:

Title Suso's Java
Author Joy Bhattacharya
Author Email bindaas_panchi [at] hotmail.com
Description Easy to read , Easy to understand code...

Category Java » Beginners / Lab Assignments
Hits 11232
Code Select and Copy the Code
Code : import java.io.DataInputStream; class ArraySorter { private int in_array[] = new int[10]; private int in_array1[] = new int[10]; public ArraySorter(int[] n) { in_array = n; in_array1 = n; } public void bub_sort() { int temp=0; for(int a=0;a<in_array.length-1;a++) { for(int b=0;b<in_array.length-1-a;b++) { if(in_array[b] > in_array[b+1]) { temp = in_array[b]; in_array[b] = in_array[b+1]; in_array[b+1] = temp; } } } } public void sel_sort() { int large=0,index=0; for(int i=in_array1.length-1;i>=1;i--) { large = in_array1[0]; index = 0; for(int j=1;j<=i;j++) { if(in_array1[j] > large) { large = in_array1[j]; index = j; } } in_array1[index] = in_array1[i]; in_array1[i] = large; } } public void display(int ch) { if(ch == 0) { System.out.println(" Array Contents...in_array[]=> "); for(int i=0;i<in_array.length;i++) { System.out.print(" " + in_array[i] ); } } else { System.out.println(" Array Contents...in_array1[]=> "); for(int i=0;i<in_array1.length;i++) { System.out.print(" " + in_array1[i] ); } } } } public class ArrayTest { public static void main(String[] args) { int[] array = new int[10]; int cond; cond = 0; int num=0; for(int i=0;i<array.length;i++) { DataInputStream in = new DataInputStream(System.in); try { System.out.print("Enter the data: "); num = Integer.parseInt(in.readLine()); System.out.println(); array[i] = num; } catch (Exception e) {} } ArraySorter a = new ArraySorter(array); System.out.println(" Displaying present data... "); a.display(cond); System.out.println(" Sorting Data...Bubble Sort "); a.bub_sort(); System.out.println(" Displaying Sorted Data... "); a.display(cond); cond = 1; System.out.println(" Displaying present data... "); a.display(cond); System.out.println(" Sorting Data...Selection Sort "); a.sel_sort(); System.out.println(" Displaying Sorted Data... "); a.display(cond); }

Related Source Codes

Script Name Author
Sending mail Using JavaMail to Yahoo and Gmail accounts sai prasad
Simple Program in Java to Implement Multithreading Satish.K
Simple Calculator in Java Using Remote Method Invocation Satish.K
Guest Book Application Using Servlets Satish.K
String Manipulation Using Stringification Satish.K
String Manipulation Using Stringification Satish.K
Moving Ball Application Using Java Beans Satish.K
Rapid Roll game subrahmanyeswararao
student mgm arpan
Sourav Datta
Download Manager Sagar
Address Book in Java Rahul Chouhan
address book using java database connectivity(jdbc-msaccess) shekhar bansal
sun Steganography B.Rajavel
Connecting Java with MS-Access - Inserting data in Aseem

A D V E R T I S E M E N T




Google Groups Subscribe to SourceCodesWorld - Techies Talk
Email:

Free eBook - Interview Questions: Get over 1,000 Interview Questions in an eBook for free when you join JobsAssist. Just click on the button below to join JobsAssist and you will immediately receive the Free eBook with thousands of Interview Questions in an ebook when you join.

New! Click here to Add your Code!


ASP Home | C Home | C++ Home | COBOL Home | Java Home | Pascal Home
Source Codes Home Page

 Advertisements  

Google Search

Google

Source Codes World.com is a part of Vyom Network.

Vyom Network : Web Hosting | Dedicated Server | Free SMS, GRE, GMAT, MBA | Online Exams | Freshers Jobs | Software Downloads | Interview Questions | Jobs, Discussions | Placement Papers | Free eBooks | Free eBooks | Free Business Info | Interview Questions | Free Tutorials | Arabic, French, German | IAS Preparation | Jokes, Songs, Fun | Free Classifieds | Free Recipes | Free Downloads | Bangalore Info | Tech Solutions | Project Outsourcing, Web Hosting | GATE Preparation | MBA Preparation | SAP Info | Software Testing | Google Logo Maker | Freshers Jobs

Sitemap | Privacy Policy | Terms and Conditions
Copyright ©2003-2017 SourceCodesWorld.com, All Rights Reserved.
Page URL: http://www.sourcecodesworld.com/source/show.asp?ScriptID=868


Download Yahoo Messenger | Placement Papers | Free SMS | C Interview Questions | C++ Interview Questions | Quick2Host Review