i getting compilation error each time try compile code snippet. error "illegal start of type" , occurs @ "for(int i=0;i
class hello { int a[]={3,4,2,7,4,9,1,4,6,3}; int n=a.length; for(int i=0;i<n;i++) { for(int j=i;j<n-i-1;j++) { //ascending order if(a[j-1]>a[j]) { int temp=a[j]; a[j]=a[j-1]; a[j-1]=temp; } } } for(int i=0;i<n;i++) system.out.println(a[i]); }
i realized error. forgot make main method.
Comments
Post a Comment