静态应用举例
来源:互联网 发布:c语言中static的用法 编辑:程序博客网 时间:2024/06/06 01:29
package java151217;
/*
*
* 不同类中拥有同一个功能...
* 静态的应用...
*/
public class Demo {
public static void main(String[] args) {
int[] arr = { 3, 4, 1, 8 };
// int max = 0;
// for (int i = 0; i < arr.length; i++) {
// if (arr[i] > arr[max]) {
// max = i;
// }
// }
// System.out.println("max=" + arr[max]);
getMax(arr);
}
/**
* 获取数组的最大值
*/
public static int getMax(int[] arr) {
int max = 0;
for (int i = 0; i < arr.length; i++) {
if (arr[i] > arr[max]) {
max = i;
}
}
// System.out.println("max="+arr[max]);
return arr[max];
}
}
class Test {
public static void main(String[] args) {
int[] arr = { 3, 4, 1, 8 };
getMax(arr);
}
/**
* 获取数组的最大值
*/
public static int getMax(int[] arr) {
int max = 0;
for (int i = 0; i < arr.length; i++) {
if (arr[i] > arr[max]) {
max = i;
}
}
// System.out.println("max="+arr[max]);
return arr[max];
}
}
/*
*
* 不同类中拥有同一个功能...
* 静态的应用...
*/
public class Demo {
public static void main(String[] args) {
int[] arr = { 3, 4, 1, 8 };
// int max = 0;
// for (int i = 0; i < arr.length; i++) {
// if (arr[i] > arr[max]) {
// max = i;
// }
// }
// System.out.println("max=" + arr[max]);
getMax(arr);
}
/**
* 获取数组的最大值
*/
public static int getMax(int[] arr) {
int max = 0;
for (int i = 0; i < arr.length; i++) {
if (arr[i] > arr[max]) {
max = i;
}
}
// System.out.println("max="+arr[max]);
return arr[max];
}
}
class Test {
public static void main(String[] args) {
int[] arr = { 3, 4, 1, 8 };
getMax(arr);
}
/**
* 获取数组的最大值
*/
public static int getMax(int[] arr) {
int max = 0;
for (int i = 0; i < arr.length; i++) {
if (arr[i] > arr[max]) {
max = i;
}
}
// System.out.println("max="+arr[max]);
return arr[max];
}
}
0 0
- 静态应用举例
- 静态应用举例2
- android Spinner(下拉菜单)的应用举例1---静态实现
- RewriteCond和13个mod_rewrite应用举例Apache伪静态
- RewriteCond和13个mod_rewrite应用举例Apache伪静态
- 静态数据成员和静态成员函数在类中的应用举例
- 静态变量举例
- RewriteCond和13个mod_rewrite应用举例Apache伪静态之htaccess编写
- RewriteCond和13个mod_rewrite应用举例Apache伪静态之htaccess编写
- xpath应用举例
- jasperReport应用举例
- 变长参数应用举例
- PIX 防火墙应用举例
- 串操作应用举例
- PIX 防火墙应用举例
- DataFormatString应用举例
- Mysqlbinlog 命令应用举例
- 字符串倒置应用举例
- SPI
- 静态如何应用?
- centos7下使用yum安装mysql
- 第十五周 用哈希法组织关键字
- SDUT 2254 字母螺旋方阵(递归)
- 静态应用举例
- 在Objective-c里面使用property教程
- 静态应用举例2
- Android微信登陆
- C++位操作
- hdu 2059 龟兔赛跑
- 取自己上一层目录路径。
- 第 20 章 多任务和多线程
- java中的继承