Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true


C Books Guide and List
C++ Books Guide and List
Best Java Books

3.8k questions

4k answers


10.7k users

0 votes
sir i am able to print the array in reverse order by using below code but i am not able to reverse the given array.
public class Reverse
    public static void main(String args[])
        int a[]={1,2,3,4,5,6,7,8,9};
        for(int i=a.length-1;i>=0;i--)
asked by Geek (15.3k points) 19 43 70

1 Answer

+1 vote
Best answer

well try ..that is absolutely correct but we have to do some more  work... 

public class ReverseArray{
public static void main(String ar[]){
int array[]={5,4,1,7,9,6};
for(int i=array.length-1,j=0;i>array.length/2-1;i--,j++){
int temp=array[j];
for(int k=0;k<array.length;k++)
System.out.print(array[k]+"  ");
answered by Expert (11.4k points) 16 23 32
selected by

Related questions

0 votes
1 answer 3.4k views
3.4k views asked by sara Guru (24.6k points) 32 59 94
0 votes
1 answer 48 views
0 votes
1 answer 228 views
228 views asked by augustaina Sr Member (4.8k points) 10 26 32
+1 vote
1 answer 38 views
38 views asked by keem Expert (13.2k points) 29 44 63