Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- abstract class Parent<T>
- {
- public T a[];
- public abstract void sort(T a[]);
- public abstract void searc(T a[]);
- }
- class B_Sort<T> extends Parent<T>
- {
- @Override
- public void sort(T[] a) {
- for(int i =1; i< a.length; i++){
- for(int j = 0; j < (a.length - i); j ++){
- if((((Comparable) (a[j])).compareTo(a[j+1])) > 0){
- T tmp = a[j];
- a[j] = a[j + 1];
- a[j + 1] = tmp;
- }
- }
- }
- }
- @Override
- public void searc(T[] a) {
- }
- }
- public class ProjectX {
- public static void main(String[] args) {
- int [] a={2,3,1,5};
- Parent<Integer> cc=new B_Sort<>();
- cc.sort(a);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement