摘要: #include <stdio.h>//这儿表示的函数的输入输出头文件void swap(int x,int y);void swap_p(int *x,int *y);//表示调用一个方法时必须声明这个方法的原型,否则不能调用(方法二)#define swap_m(x,y,t)((t)=(x),( 阅读全文
posted @ 2016-08-22 13:44 caocx 阅读(759) 评论(0) 推荐(0) 编辑
摘要: 代码如下: package four.day8.com; public class Person { private String name;; private int age; public Person() { super(); } public Person(String name,int a 阅读全文
posted @ 2016-08-08 15:35 caocx 阅读(267) 评论(0) 推荐(0) 编辑
摘要: 代码如下 Student.java package four.com; public class Student extends Person { // private String name; // private int age; public Student(){} public Studen 阅读全文
posted @ 2016-08-03 13:59 caocx 阅读(173) 评论(0) 推荐(0) 编辑
摘要: 代码如下: package cao.com.duixiang; public class TestCCircle { public static void main(String[] args) { PassObjectt op = new PassObjectt(); CircleC cc = n 阅读全文
posted @ 2016-07-28 16:03 caocx 阅读(230) 评论(0) 推荐(0) 编辑
摘要: 方法的重载(overload)要求:1,同一个类中2,方法名必须相同3,方法的参数列表不同(1,参数的个数不同2,参数类型不同,但是参数名相同) 注:方法的重载与方法的返回值类型没有关系 package cao.com.duixiang; public class OverloadTest { pu 阅读全文
posted @ 2016-07-28 14:32 caocx 阅读(231) 评论(0) 推荐(0) 编辑
摘要: 两个类如下 package cao.com.duixiang; import java.util.Arrays; public class OtherTest { //求max public int getMax(int[] arr) { int max = arr[0]; for(int i=1; 阅读全文
posted @ 2016-07-28 14:30 caocx 阅读(400) 评论(0) 推荐(0) 编辑
摘要: 注:选择排序就是从第一个数开始依次遍历,找出最小的数,然后交换位置,直到剩余元素只有一个为止。 代码如下: public class MaoPao { public static void main(String[] args){ //直接选择排序 int[] arr = new int[]{49, 阅读全文
posted @ 2016-07-27 20:37 caocx 阅读(202) 评论(0) 推荐(0) 编辑
摘要: public class MaoPao { public static void main(String[] args){ int[] arr = new int[]{49,38,65,76,13,27,49}; //i代表的是查询的轮数 for(int i=0;i<arr.length;i++){ 阅读全文
posted @ 2016-07-27 18:00 caocx 阅读(193) 评论(0) 推荐(0) 编辑
摘要: 代码如下: public class ErArray { public static void main(String[] args) { //杨辉三角 int[][] num = new int[10][]; //初始化动态数组 for(int i=0;i<num.length;i++){ //这 阅读全文
posted @ 2016-07-27 15:10 caocx 阅读(282) 评论(0) 推荐(0) 编辑
摘要: import java.util.Scanner;public class TestStudent { public static void main(String[] args) { //从键盘获得数据 Scanner scan = new Scanner(System.in); //输入学生个数 阅读全文
posted @ 2016-07-27 11:19 caocx 阅读(2017) 评论(0) 推荐(0) 编辑