Q without A

  1. Nature's last word
  2. why using single quotes update variable? not double quotes?
    $ export PS1='${RANDOM} $ '
    $ export PS1="${RANDOM} $ "
  3. In svn, this is not working:
    $ svn copy -r 9 file:///Users/username/myrepos/trunk/baz.c baz.c
    // however this is working:
    $ svn copy file:///Users/username/myrepos/trunk/baz.c@9 baz.c
  4. Why using %s to display enum type values?
    // getScale() returns enum type
    out.printf("%5.2f degrees %s%n", getNumber(), getScale());
  5. Java, what's the difference between:
    List<String> list = new ArrayList<String>(Arrays.asList("one", "two", "", "three"));
    // version 1:
    List<String> sub = new ArrayList<String>(list.subList(1,3));
    // version 2:
    // work
    list.remove(sub); List<String> sub2 = list.subList(1,3);
    // won't work:
    list.removeAll(sub2); // why???
  6. why does this work:
    public class Wildcards {
        public static void main(String[] args) {
            Holder<?> unbounded = new Holder<Long>();
            Long lng = 1L;
            Object r11 = wildSubtype(unbounded, lng);  // why can pass in Holder<?> to wildSubtype(Holder<? extends T> holder, T arg)?
        }
        
        static <T> T wildSubtype(Holder<? extends T> holder, T arg) {
            T t = holder.get();
            return t;
        }
    }
    
    class Holder<T> {
        private T value;
        public Holder() {}
        public Holder(T val) { value = val; }
        public void set(T val) { value = val; }
        public T get() { return value; }
    }
  7. d
  8. d
  9. d
  10. d
  11. d
  12. d
posted @ 2013-05-23 23:22  wxwcase  阅读(178)  评论(0编辑  收藏  举报