All pastes #1692509 Raw Edit

Ralph

public java v1 · immutable
#1692509 ·published 2009-11-29 14:16 UTC
rendered paste body
// Base class for all sorter classespackage ralph.sorting;import java.util.Scanner;abstract class SortingTechnique {	protected int[] x;	protected int n;	protected SortingTechnique() {		Scanner read = new Scanner(System.in);		System.out.println("Enter the size of the array.");		n = read.nextInt();		x = new int[n];		for (int i = 0; i < n; i++) {			System.out.println("Enter the element no. " + (i + 1));			x[i] = read.nextInt();		}	}	public void display(String msg) {		System.out.println(msg);		for (int i = 0; i < n; i++)			System.out.print(x[i] + " ");		System.out.println();	}	public abstract void sort();	protected void swap(int i, int j) {		int temp = x[i];		x[i] = x[j];		x[j] = temp;	}}