对比语法错误、语义错误以及运行时错误

翻译人员: 铁锚
翻译日期: 2013年12月4日
原文链接:  Syntactic vs. Semantic vs. Runtime Errors

下面的三个例子演示了什么是语法错误、什么是语义错误以及什么是运行时错误。
语法错误(Syntactic Error)
如果一个程序包含语法错误,则不能通过编译.

public static int returnNull(){
	System.out.println("haha");
}


语义错误(Semantic Error)
如果程序包含了语义错误,则可以通过编译,但是得到的结果是错误的,或者不是所期望的功能。

public static int calSquareArea(int sideLength){
	return sideLength * 2;
}


运行时错误(Runtime Error)
Runtime errors 会在程序运行的时候发生。

public static void main(String[] args) {
	devideInt(4,0);
}
 
public static int devideInt(int a, int b){
	return a/b;
}

 

相关阅读:

 

  1. Latent Semantic Indexing
  2. How Compiler Works?
  3. Java Generic related problems
  4. An Example of Java Static Type Checking

 

 

转载于:https://www.cnblogs.com/fuhaots2009/p/3459183.html

PDF文件大小为130M,PDF带目录索引,高清版 这是Power BI 官方中文教程的高清无删减版 连接到 Oracle数据库 在 Power b| Desktop中运行 Python脚本 在 Power查询编辑器中使用 Python 将外部 Python|DE与 Power bl一起使用 使用 Python创建 Power b|视觉村象 在 Power b| Desktop中运行R脚本 在查询编辑器中使用R 将外部R|DE与 Power b|一起使用 受支持的R包 值接在 Power b| Desktop中输入数据 在 Power Bl Desktop中连接到Exce Power b| Desktop中的 Analysis Services多维数据 通过 Power b| Desktop连接到CS∨文件 在 Power b| Desktop中连接到 Google BigQuery数据库 在 Power BI Desktop中连接到 Impala数据库 通过 Power BI Desktop连接到 OData数据源 在 Power b| Desktop中连接到 Amazon redshift数据库 通过 Power BI Desktop连接到网页 连接到 Power BI Desktop中的雪花型计算仓库 连接到 Microsoft Azure Consumption Insights 在 Power Bl Desktop中使用 SAP HANA Power BI Desktop中的 Analysis Services表格数据 在 Power b| Desktop中使用 DirectQuery Oracle和 Teradata数据库的 DirectQuery DirectQuery FA SAP Business Warehouse(BW) DirectQuery和 SAP HANA Power BI Desktop中的假设引用完整性设置 在 Power b| Desktop中使用 SAP BW连接器(预览) 在 Power b| Desktop中使用 One Drive for business链接 第三方服务:适用于 Power b| Desktop的 Facebook连接器 第三方服务:适用于 Power b| Desktop的 Google Analytics连接器 Project Online:通过 Power BI Desktop连接到数据
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值