kotlin - Kotlin 可以定义为强类型语言吗?

标签 kotlin strong-typing

从强类型语言的定义来看:

A strongly-typed programming language is one in which each type of data (such as integer, character, hexadecimal, packed decimal, and so forth) is predefined as part of the programming language and all constants or variables defined for a given program must be described with one of the data types (source)



从 kotlin 文档中,我可以理解 kotlin 是一种 静态类型的 语言,因为变量的类型在编译时是已知的,但是强类型或弱类型呢?我在谷歌上找不到任何明确的回应。据我了解,Kotlin 应该与 Java 具有同样的强类型,因为它可以编译为 Java 字节码,但我不是 100% 确定。请帮助我了解我是否走在正确的道路上。

最佳答案

弱类型语言具有不兼容类型之间的隐式转换,而强类型语言不允许这样做。

Kotlin 没有类型之间的隐式转换 - 这使得 强静态类型

关于kotlin - Kotlin 可以定义为强类型语言吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54143972/

相关文章:

php - php5 中返回类型的一致性

c# - 如何对预期编译失败的 C# 代码进行单元测试以进行负面测试?

kotlin - 如何在流中解构 Kotlin 对象

android - 当我们对 fragment 使用依赖注入(inject)时,将数据从 fragment 发送到另一个 fragment

java - Kotlin 使用的 Java 库中的泛型和继承

.net - JSON 反序列化为继承的类型

c# - 您如何使用可以是多种类型的变量?

autocomplete - 有什么方法可以禁用某些扩展功能的自动完成功能?

java - 如何使用android中的函数进行异步计数器

C# 泛型 : Can I combine overloaded methods into one with different return/input data types?