初学Java 时.在非常长一段时间里,总认为基本概念非常模糊. 后来才知道.在很多Java 书中.把对象和对象的引用混为一谈. 假设分不清对象与对象引用,那实在没法非常好地理解以下的面向对象技术.把自己的一点认识写下来,也许能让初学Java 的朋友们少走一点弯路. 为便于说明,我们先定义一个简单的类: class student{ int name; int age; int sex; } 有了这个类( 模板) ,就能够用它来创建对象:student stu1 = new student();
(1)用static修饰类成员变量(属性),表明该变量是静态的,无论创建多少对象,都只创建一个一个静态属性副本,也就是对象们共享同一个静态属性,这个方法常用的一个用途就是用来计算程序调用了多少次这个类来创建对象也就是创建过多少个对象. #ifndef TIME_H_ #define TIME_H_ #include <iostream> using namespace std; class Time { private: int hours; int minutes; int seconds;
一位cornell的教授做的计算机类期刊会议依据Microsoft Research引用数的排名 link:http://www.cs.cornell.edu/andru/csconf.html The following are the journals and conferences in computer science that have published at least 100 papers (2003–2013), with at least 5 citations per pa
在Java中,变量分为两类: 1.基本类型变量,java是传递的副本 2.一切对象型变量,传引用副本的实质是复制指向地址的指针 a.基本类型引用 public class BasicTransmit { public static void test(boolean test){ test =! test; System.out.println("in test : test = "+test); } public static void main(String[] args) { b
转自:http://www.cnblogs.com/huangyu/archive/2004/08/02/29622.html 从宏观的角度来看,对象是类的实例.比如: //定义一个名为Someone的类,代表这么一些人(通过指定年龄,性别,性格等基本信息)class Someone { public int age; public string sex; public string name; //other...}//......//创建一个Someone类的对象,代表昵称为nemo