Topic: JAVA 程序

  Print this page

1.JAVA 程序 Copy to clipboard
Posted by: bingfengwangzuo
Posted on: 2005-03-06 18:07

class Value{
int i;
String s;
Value(int a,String b){
i=a;
String s=b;
}

boolean equals(Value a){
if(a.i==i && a.s.equalsMoon)
return true ;
return false;
}
}
public class CmpValue{
public static void main(String[] args){
Value e1 = new Value(5,"good");
Value e2 = new Value(5,"good");
System.out.pringln("e1 == e2 is "+(e1==e2));
System.out.pringln("e1.equals(e2) is"+e1.equals(e2));

}
}
不知道为什么总是编译不过去,请那位高手指点指点

2.Re:JAVA 程序 [Re: bingfengwangzuo] Copy to clipboard
Posted by: bingfengwangzuo
Posted on: 2005-03-06 19:14

public class CmpString{
public static void main(String[] args){
String s= new String("are you ready");
String z= new String("are you ready");
System.out.println("s==z is "+(s==z));
System.out.println("s.equalsSleepy is "+s.equalsSleepy);
System.out.printlnMoon;
}
}
能正常编译
class Value{
int i;
String s;
Value(int a,String b){
i=a;
s=b;
}

boolean equals(Value a){
if(a.i==i && a.s.equalsMoon)
return true ;
return false;
}
}
public class CmpValue{
public static void main(String[] args){
boolean result= true;
Value e1 = new Value(5,"good");
Value e2 = new Value(5,"good");

System.out.pringln("e1 == e2 is "+result);

System.out.pringln("e1 == e2 is "+(e1==e2));
System.out.pringln("e1.equals(e2) is"+e1.equals(e2));

}
}
就编译不过去,不知道为什么?请指教!

3.Re:JAVA 程序 [Re: bingfengwangzuo] Copy to clipboard
Posted by: joysea
Posted on: 2005-03-06 19:45

{{{System.out.pringln}}}}

单词写错了,pringln应该是"println"

要认真哦!

4.Re:JAVA 程序 [Re: bingfengwangzuo] Copy to clipboard
Posted by: bingfengwangzuo
Posted on: 2005-03-08 17:06

真的,很感谢你! 看来我应该下载个java 编辑器 有什么使用方便的编辑器么,
在麻烦您帮着推荐推荐!如果你需要学习资料,就请给我发邮件,联系!

5.Re:JAVA 程序 [Re: bingfengwangzuo] Copy to clipboard
Posted by: sai
Posted on: 2005-03-09 09:37

哦 `~~真是大意


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923