A recent comparison of fire of a very interesting word,工具人
In fact, object-oriented is the use of a class with a simple and convenient way to do things you have to do
these classes have been made工具人
to help you when you do not need a good package of a wheel hands
following a simple program that can be seen on object-oriented is to you do the procedure directly used,
there is work to complete the program also can use our own hands - why then,
of course, some still had to be familiar with the underlying familiar,
/*
面向过程:当需要实现一个功能的时候,每个步骤都要亲力亲为,详细处理每一个细节
面向对象:当需要实现一个功能的时候,不关心具体的步骤,而是是找员工已经具有该功能的人,来帮我做事
*/
//当我们使用JDK提供的类时,系统自动帮我们导入进来的
import java.util.Arrays;
public class cesi {
public static void main (String[] args) {
int[] array = {10, 20, 30, 40, 50};
//要求打印格式为[10, 20, 30, 40, 50]
//使用面向过程每个细节都要亲力亲为
System.out.print ("[");
for (int i = 0; i < array.length; i++) {
if (i == array.length - 1) {
System.out.println (array[i]+"]");
}else {
System.out.print (array[i]+",");
}
}
System.out.println ("===========华丽的分割线============");
//面向对象
//找一个JDK给我们提供好的Arrays类
//其中有一个tostring方法,直接就能把数组编变成我们想要的格式字符串
System.out.println (Arrays.toString (array));
}
}