(翻译说明:http://my.oschina.net/ywlaker/blog/468911)

添加新方法

  1. 在打开 VectorTest.java 文件的编辑器最后(在声明类的括号之前)输入以下内容:        
    public void testSizeIsThree()        
    当你输入完名称之后,该方法就会出现在 Outline 视图的底部。

             
    另外,

    这些错误提示表明编译有错。将鼠标悬停在错误文本处,会提示:“)”处语法错误,后面需要“{”,这是因为该方法还未声明方法体。这种错误提示会随着你继续输入而不断更新。这个过程是由 Java > Editor 首选页中的 Report problems as you type 选项控制的。          

  • 错误提示(红色长方形块)会出现在编辑器右边垂直标尺上,

  • 错误图标(红叉)会出现在编辑器左侧垂直标尺上,

  • 错误指示符(红色小方块)会出现在编辑器右上角 ,

  • 错误标记会出现在编辑器的文本中。

点击保存按钮,程序自动编译,错误将出现在包管理器视图、问题视图和垂直标尺(编辑器左边)。在包管理器视图中,错误会一直传播到项目的最上层。      

输入以下内容完成方法添加:

{          
 //TODO: Check size            

闭合的花括号会自动添加。

保存文件。随着括号的添加,错误提示也消失了。

(完)

(原文)

Adding new methods

  1. Start adding a method by typing the following at the end of the VectorTest.java file (but before the closing brace of the type) in the Java editor:        
    public void testSizeIsThree()        
    As soon as you type the method name in the editor area, the new method appears at the bottom of the Outline view.

    In addition,

    These error annotations indicate that the compilation unit is currently not correct. If you hover over the error in the text, a tool tip appears: Syntax error on token ")", { expected after this token. This is correct since the method doesn't have a body yet. Note that error annotations in the editor are updated as you type. This behavior can be controlled via the Report problems as you type option located on the  Java > Editor preference page.

  • error annotations (red boxes) appear in the overview ruler positioned on the right hand side of the editor,

  • error icons appear in the vertical ruler positioned on the left of the editor,

  • an error indicator appears in the top right corner of the editor,

  • errors are marked in the text.

Click the Save button. The compilation unit is compiled automatically and errors appear in the Package Explorer view, in the Problems view and on the vertical ruler (left hand side of the editor). In the Package Explorer view, the errors are propagated up to the project of the compilation unit containing the error.

Complete the new method by typing the following:

{          
 //TODO: Check size            

Note that the closing curly brace has been inserted automatically.

Save the file. Notice that the error indicators disappear since the missing brace has been added.

(END)

转载于:https://my.oschina.net/ywlaker/blog/470753

【Eclipse】使用指南(6)添加新方法相关推荐

  1. RegisterUserFunc为测试对象添加新方法或重写已有方法

    在实际的自动化脚本开发过程中,发现QTP提供的方法不够用,但幸好QTP的扩展性很强,RegisterUserFunc函数: RegisterUserFunc函数既可以用户自定义函数也可以重写已有的方法 ...

  2. WooCommerce入门指南:添加新订单第1部分

    在上一篇文章中,我介绍了在线商店所有者如何跟踪和管理客户下的订单. 如果您想手动下订单怎么办? 这是今天文章的主题,我将在其中解释如何在WooCommerce中添加新订单. 添加新订单 要在WooCo ...

  3. 下载视频网站flv文件的两种方法(080526添加新方法)

    目前网路上有不少著名的网络视频网站或者播客,例如youtube.土豆.酷6.新浪播客等等,里面有许多flv视频值得下载收藏,不过这些网站都做了一定的保护措施防止下载,这里我介绍两种下载方法给大家,对绝 ...

  4. 添加jQuery方法解析url查询部分

    Web前端不同页面间传值可以使用 cookies.localStorage 和 sessionStorage 等本地存储. 但是,今天我们尝试使用 url 查询,假设我们要传递字符串 str 到 mo ...

  5. 深度学习目标检测指南:如何过滤不感兴趣的分类及添加新分类?

    编译 | 庞佳 责编 | Leo 出品 | AI 科技大本营(公众号ID:rgznai100) AI 科技大本营按:本文编译自 Adrian Rosebrock 发表在 PyImageSearch 上 ...

  6. android framework资源,android源码framework下添加新资源的方法

    编译带有资源的jar包,需要更改frameworks层,方法如下: 一.增加png类型的图片资源 1.将appupdate模块所有用到的png格式图片拷贝到framework/base/core/re ...

  7. R语言为dataframe添加新的数据列(add new columns):使用R原生方法、data.table、dplyr等方案

    R语言为dataframe添加新的数据列(add new columns):使用R原生方法.data.table.dplyr等方案 目录 R语言为dataframe

  8. R语言为dataframe添加新的数据列(横向拼接、Appending columns,Unioning columns):使用R原生方法、data.table、dplyr等方案

    R语言为dataframe添加新的数据列(横向拼接.Appending columns,Unioning columns):使用R原生方法.data.table.dplyr等方案 目录 R语言为dat

  9. uboot中添加新型号步骤以及编译方法

    一.添加新型号的支持: 1.在board.cfg 添加需要支持的型号: 2.在include/configs下添加支持新型号的.h文件: 二.uboot编译方法: 1.配置编译的环境变量: expor ...

最新文章

  1. 章节六、2-异常---运行时异常
  2. 2017年公众号32篇热文回看
  3. 中国PaaS/SaaS市场研究(2021)
  4. Redis Sentinel 机制与用法(二)
  5. 斜齿轮重合度计算公式_斜齿轮的端面重合度计算
  6. kali解压deb_Kali下安装网易云音乐
  7. android路由器安装wifidog,openwrt下的wifidog安装及web认证界面设置
  8. 买房? 上区块链, 安排! 全国首张不动产区块链电子凭证诞生
  9. 全球IT经理一致喜爱的ITSM系统、it服务台软件
  10. 南邮 OJ 1128 An Industrial Spy
  11. 小球自由落体及碰撞反弹
  12. 离散模型——多属性决策
  13. STM32F10x单片机Flash写操作导致中断不响应问题
  14. 腾讯资深产品经理谈敏捷开发于游戏
  15. C语言:输出n行由大写字母A开始构成的三角形字符阵列。
  16. 零点极点传递函数以及伯德图
  17. 【小程序】图解小程序平台架构及其特征与应用机制
  18. 北外《战略管理》知识点分解
  19. 计算机专业博士推荐信模板,计算机推荐信模板
  20. APP如何快速开发?运用这个方法一天开发完成

热门文章

  1. UE4蓝图切换玩家行走跑步姿势
  2. cad模糊查询符号_SQL 模糊查询之特殊字符
  3. 传智播客35期JavaEE工程师从基础到实战视频
  4. UTF8 与 UTF8 +BOM
  5. matlab ellipticf,[Matlab]椭圆滤波器设计:低通、高通、带通和带阻
  6. 计算机专业用苹果哪款笔记本,2019笔记本电脑排行榜 苹果笔记本电脑哪款好
  7. Python 导入模块是变量名时如何导入
  8. 无线充电的原理是什么?
  9. 算法导论第十三章 红黑树
  10. 双11,当当图书大放价,专属200-30优惠码免费送