李玉刚霓裳羽衣曲歌词:关于刚开始学习JAVA的一个小程序

来源:百度文库 编辑:中科新闻网 时间:2024/05/12 04:54:21
大家来帮我看下这个程序哪错了,我找了好久按照书上面打的
public class OperatorsAndExpressions{
void priorityOfArithmaticOperatior(){
int a=10,b=4,c=20,d=6;
System.out.println(a+b*c+d);
System.out.println(a+c%b);
System.out.println(a++*b+c*--d);
}
public static void main(String args[]){
OperatorsAndExpressions OperAndExp=new OperatorsAndExpressions();
OperAndExp.priorityOfArithmaticOperator();
}
}

楼上的在扯蛋,勿人子弟!
根本就不用改,你改只是改运算符的优先级有屁用,鄙视你外行!
class OperatorsAndExpressions
{
int a=10,b=4,c=20,d=6;
OperatorsAndExpressions(){}
void priorityOfArithmaticOperatior()
{

System.out.println(a+b*c+d);
System.out.println(a+c%b);
System.out.println(a++*b+c*--d);
}
public static void main(String args[])
{

OperatorsAndExpressions OperAndExp=new OperatorsAndExpressions();
OperAndExp.priorityOfArithmaticOperatior();
}
}
/** 错误1:多了1个public 错误2:priorityOfArithmaticOperatior();你单词写错了 */

OperAndExp.priorityOfArithmaticOperator();
改为:
OperAndExp.priorityOfArithmaticOperatior();

注意名称拼写。

试试看

欢迎访问:
http://hi.baidu.com/mrchr