本文介绍了Java8是否支持运算符重载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我感兴趣的是有没有办法在Java 8中重载运算符?是否存在类似

So I'm interested is there a way to overload operator in Java 8? Is there exist something like

void operator(){ }

C ++

推荐答案

不,Java 8中没有运算符重载。如果您还不知道,可以查看这是一种编译为纯Java的JVM语言。它支持运算符重载和更多功能,同时它仍然具有静态类型系统。

No, there is no operator overloading in Java 8. If you don't know it yet, you could have a look at Xtend which is a JVM language that compiles to pure Java. It supports operator overloading and a lot more features while it's still has a static type system.

(当然,还有Groovy,Scala和其他JVM脚本语言它也支持运算符重载。)

(And, of course, there is Groovy, Scala, and other JVM scripting languages which support operator overloading as well).

这篇关于Java8是否支持运算符重载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-17 01:21