请问在eclipse反编译class文件中经常看到,有的方法画着有两条黑线,如下图所示:
听说有这样标记的方法是不被提倡使用的方法,听说因为版本更新等原因,
这些方法虽然被保留着,但是以后不提倡使用,是这样吗?
希望有经验的前辈赐教。

解决方案 »

  1.   

    你的理解是对的。只要在方法注释上加 @deprecated比如    /**
         * Allocates a <code>Date</code> object and initializes it so that 
         * it represents midnight, local time, at the beginning of the day 
         * specified by the <code>year</code>, <code>month</code>, and 
         * <code>date</code> arguments. 
         *
         * @param   year    the year minus 1900.
         * @param   month   the month between 0-11.
         * @param   date    the day of the month between 1-31.
         * @see     java.util.Calendar
         * @deprecated As of JDK version 1.1,
         * replaced by <code>Calendar.set(year + 1900, month, date)</code>
         * or <code>GregorianCalendar(year + 1900, month, date)</code>.
         */
        @Deprecated
        public Date(int year, int month, int date) {
            this(year, month, date, 0, 0, 0);
        }