日期:2014-05-20  浏览次数:20770 次

带双划线的方法有什么含义?

请问在eclipse反编译class文件中经常看到,有的方法画着有两条黑线,如下图所示:




听说有这样标记的方法是不被提倡使用的方法,听说因为版本更新等原因,
这些方法虽然被保留着,但是以后不提倡使用,是这样吗?
希望有经验的前辈赐教。









------解决方案--------------------
你的理解是对的。

只要在方法注释上加 @deprecated

比如
Java code

    /**
     * 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);
    }

------解决方案--------------------
都知道了还问。我是来接分的。嘿嘿。
------解决方案--------------------
自己对了,那是老版本的。用新版本的好多了。

------解决方案--------------------
这个和反编译没多大关系吧
话说,是一条线啵
------解决方案--------------------
为什么我只看到一条黑线呢=。=
现在脑袋上倒是有三条黑线。。。
------解决方案--------------------
探讨
为什么我只看到一条黑线呢=。=
现在脑袋上倒是有三条黑线。。。