本帖最后由 顾亦飞 于 2012-6-22 10:46 编辑
- class Dog //编译一直提示要标识符,不怎么回事。
- {
- String name;
- String says;
- void setDog(String n,String s)
- {
- this.name = n;
- this.says = s;
- System.out.println("name="+name+" +says="+says);
- }
-
- }
- public class DogTest
- {
- public static void main(String[] args)
- Dog d1 = new Dog();
- d1.setDog(spot,Ruff!);
- Dog d2 = new Dog();
- d2.setDog( scruffy, Wurf!);
- }
复制代码 |
|