1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

Output??

Discussion in 'Java' started by gouri.83, Dec 3, 2007.

  1. gouri.83

    gouri.83 New Member

    Joined:
    Dec 3, 2007
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    Code:
    public class ArrayListDemo {
    
           public static void rotate(List<?> list) {
                   if (list.size() == 0)
                           return;
                   list.add(list.remove(0));
           }
    
           public static void main(String[] args) {
                   ArrayListDemo ald=new ArrayListDemo();
                   List<String> demo=new ArrayList<String>();
                   demo.add("uk");
                   ald.rotate(demo);
                   if(demo.size() > 1) {
                           System.out.println("i know surely size >1");
                   }else {
                           System.out.println("this cannot happen...size is
    0");
                   }
           }
    }
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,276
    Likes Received:
    364
    Trophy Points:
    83
    Submitted as an article and moved to forum for discussion
     

Share This Page