package hiwari;
/** 定义一个Max类,其中包括两个重载方法gemax,* 分别可返回2个整数中的最大值和三个整数中的最大值,* 并在主函数中创建max类对象,分别求(2,3)的最大值和(2,8,100)中的最大值* */
public class Max {int getmax(int a,int b){if (a>b) return a;else return b;}int getmax(int a,int b,int c){if(a>b)if(a>c) return a;else return c;else if(b>c) return b;else return c;}public static void main(String[] args) {// TODO Auto-generated method stubMax bb=new Max();System.out.ax(9, 5, 12));System.out.ax(2,4));}}
本文发布于:2024-01-28 06:11:29,感谢您对本站的认可!
本文链接:https://www.4u4v.net/it/17063934955372.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |