如何在Java中使一个类执行数学运算?

huangapple 未分类评论57阅读模式
英文:

How to make a class operate with math operation in java?

问题

例如

myClass x = new myClass(5);
myClass y = new myClass(2);
System.out.println(x+y);

输出:

7

在Number类中相同。

英文:

for example

myClass x = new myClass(5);
myClass y = new myClass(2);
System.out.println(x+y);

Output:

7

the same in Number classes

huangapple
  • 本文由 发表于 2020年4月6日 16:31:31
  • 转载请务必保留本文链接:https://java.coder-hub.com/61055789.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定