1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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,285
    Likes Received:
    364
    Trophy Points:
    83
    Submitted as an article and moved to forum for discussion
     

Share This Page