JAVA的简单问题.

来源:百度知道 编辑:UC知道 时间:2024/04/28 00:02:38
public static void main(String argc[]){
oper operandexp=new oper(); 这句是什么意思啊?
operandexp.stringPlus();
}

有些部分程序我没写.
oper operandexp=new oper(); 这句是什么意思啊?详细点的好

oper是个你已经定义好的类

oper operandexp=new oper();的意思是:
分两步
oper operandexp;创建一个oper的引用,名称为 operandexp
operandexp = new oper(); 让operandexp指向新创建的oper对象
其中new oper()是创建一个oper对象

oper operandexp=new oper(); //这是一个类事例化的过程我也不知道怎么解释比较好 看下面个程序吧
class test{ //定义个test类
public void testPrint()//该类的一个方法
{
System.out.print("...");
}
}
在main函数里面就这样用了
test testNew = new test();//初始化test类的一个对象 就是上面你问了的

你给的实在太少,不过可以开始oper应该是作者自己定义的一个类,oper operandexp=new oper();只不过是构造出一个oper的对象而已。

这是谁写的代码这么丑。。。你回去告诉他,Java类首字母要大写!!!