zoukankan      html  css  js  c++  java
  • 动手动脑

    package one;
    // MethodOverload.java
    // Using overloaded methods
    public class MethodOverload {
        public static void main(String[] args) {
            System.out.println("The square of integer 7 is " + square(7));
            System.out.println(" The square of double 7.5 is " + square(7.5));
        }
        public static int square(int x) {
            return x * x;
        }
        public static double square(double y) {
            return y * y;
        }
     

    该代码是向我们展示了重载的特性,

    满足以下条件的两个或多个方法构成“重载”关系:

    1)方法名相同;

    2)参数类型不同,参数个数不同,或者是参数类型的顺序不同。

    方法的返回值不作为方法重载的判断方法。

  • 相关阅读:
    预定义规则 取范围数据
    oracle table 数组的赋值方法
    java 缓存读写
    webpack
    vscode setting
    webpack babel
    共享你的vscode配置
    github API很丰富
    tips
    todo
  • 原文地址:https://www.cnblogs.com/lixv2018/p/9786548.html
Copyright © 2011-2022 走看看