Output??

gouri.83's Avatar, Join Date: Dec 2007
Newbie Member
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");
               }
       }
}
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Submitted as an article and moved to forum for discussion