class Program { class Data : IComparable { public string name; //这些必需要加public,否则会出错的 public int age; public void ...
分类:
编程语言 时间:
2014-12-07 17:38:51
阅读次数:
159
1、Object对象
创建Object对象,
var person = new Object(); var person = {
Person.name = “guoliang”; name : “guoliang”,
Person.age = 20; age : 20
};...
分类:
编程语言 时间:
2014-12-06 18:15:54
阅读次数:
242
我们一般使用equals都是为了比较对象的内容,而Object里面的equals方法却是比较对象的引用,如下:public boolean equals(Object obj) {
return (this == obj);
}所以当我们想要比较的是对象的内容时,需要重写equals方法,假设User类中有String name , int age 两个字段,用eclips...
分类:
编程语言 时间:
2014-12-06 14:08:52
阅读次数:
182
//今天老师叫用一个struct函数做一个函数指针循环 突然我都不知道struct函数怎么用了 害的我下去查了很多资料第一个定义法:int fun1(){ struct student{ int age; int nume; } struct student stu={10,20};}第二种定义法i...
分类:
其他好文 时间:
2014-12-05 21:10:09
阅读次数:
362
public class UserAction { private String name; private int age; public String add(){ System.out.println(name+age); return "...
分类:
其他好文 时间:
2014-12-05 16:49:57
阅读次数:
173
比如我有两个变量,我要将a转换成字符串,将b转换成JSON对象: var a={“name”:”tom”,”sex”:”男”,”age”:”24″}; var b=‘{“name”:”Mike”,”sex”:”女”,”age”:”29″}‘; 在Firefox,chrom...
分类:
Web程序 时间:
2014-12-04 20:08:16
阅读次数:
202
function Person(age){ var name = "Lala"; //私有变量 this.age = age; //公有变量 this.getName = function(){ //公有函数 return name; }}var p1...
分类:
其他好文 时间:
2014-12-04 17:31:21
阅读次数:
203
原型中的方法是共享的,如果每次创建构造函数时不必在重新在原型中添加方法function Person(name,age){ this.name = name; this.age = age; //方法 if(typeof this.sayName != "function") { ...
分类:
其他好文 时间:
2014-12-04 13:38:00
阅读次数:
129
1、结构体的声明: 1)struct Student{ int stu_id; char name[25] int age; char sex; }; Student student1, student2; 2)struct Student{ int stu_...
分类:
其他好文 时间:
2014-12-04 13:36:00
阅读次数:
130
一维数组排序可以使用asort、ksort等一些方法进程排序,相对来说比较简单。二维数组的排序怎么实现呢?使用array_multisort和usort可以实现例如像下面的数组:代码如下:$users = array( array('name' => 'tom', 'age' => 20) ...
分类:
编程语言 时间:
2014-12-04 11:48:18
阅读次数:
201