zoukankan      html  css  js  c++  java
  • 2020/10/5 动手动脑

    一.

    import java.util.Random;
    public class inta {
    	public static void main(String args[])
    	{
    		Random r = new Random(System.currentTimeMillis());
    		for(int i=1;i<1000;i++)
    		{
    			int m=r.nextInt();
    			m=(16807*m+0)%2147483647;
    			System.out.print(m+" ");
    			if(i%10==0)
    				System.out.print("
    ");
    		}
    	}
    
    }
    

     

    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)//int类型
    	{
    		return x * x;
    	}
    
    	public static double square(double y)//double类型
    	{
    		return y * y;
    	}
    }
    

     

    使用了java 的方法重载,(1)方法名相同;
    (2)参数类型不同,参数个数不同,或者是参数类型的顺序不同

    二.怎么才可以用传参的值把主函数的改变

  • 相关阅读:
    C语言内存分析
    算法之快速排序
    单链表逆转
    C程序设计语言之一
    vim插件配置(一)
    makefile示例
    cocos2d基础入门
    Makefile
    Makefile
    GCC编译四阶段
  • 原文地址:https://www.cnblogs.com/qiangini/p/13768927.html
Copyright © 2011-2022 走看看