`
lovejing007
  • 浏览: 93879 次
社区版块
存档分类
最新评论

@SuppressWarnings("unused")

    博客分类:
  • J2EE
阅读更多
屏蔽java编译中的一些警告信息。unused这个参数是屏蔽:定义的变量在代码中并未使用且无法访问。java在编译的时候会出现这样的警告,加上这个注解之后就是告诉编译器,忽略这些警告,编译的过程中将不会出现这种类型的警告

JDK5.0后的新特性,你在使用IDE如eclipse的时候,当你定义了一个变量如int a=0;但是你后面根本就没有使用到这个变量,这一行的前面会有一个黄色的警告标志,你将鼠标移动到上面会提示“这个变量从未被使用”,你用上面的注解(加@)后就没有这个提示了。

分享到:
评论

相关推荐

    Java分组、分页源码

    @SuppressWarnings("unused") private List pageList;// 存放分页中5页信息 @SuppressWarnings("unused") private boolean isFirstPage;// 是否为第一页 @SuppressWarnings("unused") private boolean ...

    ssh 万能类分页系统,可复用!

    @SuppressWarnings("unused") private boolean isFirstPage;//是否为第一页 @SuppressWarnings("unused") private boolean isLastPage;//是否为最后一页 @SuppressWarnings("unused") private boolean has...

    java写字板字体文件类源代码

    @SuppressWarnings("unused") int i = this.showConfirmDialog(myNotepad, createJPanel(), "字体", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE); initAction(myNotepad,i); }

    BluetoothDemoV1.2

    @SuppressWarnings("unused") private static final int REQUEST_ENABLE = 0x1; private static final int REQUEST_EX = 1; /* 请求能够被搜索 */ private static final int REQUEST_DISCOVERABLE = 0x2; ...

    BluetoothDemo

    @SuppressWarnings("unused") private static final int REQUEST_ENABLE = 0x1; private static final int REQUEST_EX = 1; /* 请求能够被搜索 */ private static final int REQUEST_DISCOVERABLE = 0x2; ...

    Java 电子邮件发送

    @SuppressWarnings("unused") private static Log logger = LogFactory.getLog(EmailUtil.class); /** * 发动邮件的邮件服务器 */ // private static String host = "smtp.exmail.qq.com"; private static...

    日期操作类 java

    // 格式:年-月-日 小时:分钟:秒 ... @SuppressWarnings("unused") private static final SimpleDateFormat timeFormat = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss"); public DateUtil() {

    java压缩文件源码--ZipUtils

    @SuppressWarnings("unused") private static String getRootPath(String filePath){ int index = filePath.indexOf("."); return filePath.substring(0, index); } public static void zip(String ...

    2012RobocupRuscue东大代码

    @SuppressWarnings("unused") private static final String SAY_COMMUNICATION_MODEL = "kernel.standard.StandardCommunicationModel"; private static final String MAX_PLATOON_CHANNELS_KEY = "comms....

    Excel POI读取封装(文件+示范代码)

    @SuppressWarnings("rawtypes") Class classzz) { if (null == classzz) throw new RuntimeException("参数不对…………"); Object obj = null; if (classzz == Integer.class) { if (src.contains(".")) { ...

    jsp分页插件--PageBean(java源码)

    @SuppressWarnings("unused") private void setTotalPage(int maxPage) { this.totalPage = maxPage; } /** * 是否有上一页数据 */ public boolean hasPrevPage() { calculate(); return hasPrevPage; ...

    阳历转阴历_java

    日历转换,阳历转阴历 下载文件可以使用 ... import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date;...import java.util.GregorianCalendar;...

    带注释的Bootstrap.java

    @SuppressWarnings("unused") URL url = new URL(repository); repositories.add( new Repository(repository, RepositoryType.URL)); continue; } catch (MalformedURLException e) { // Ignore } // ...

Global site tag (gtag.js) - Google Analytics