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

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice