当前位置: 代码迷 >> Java相关 >> class咋在程序中找不到啊
  详细解决方案

class咋在程序中找不到啊

热度:224   发布时间:2010-04-15 20:10:40.0
class咋在程序中找不到啊
class Mydate
{
    char bir;
    Mydate(char bir)
    {
        this.bir=bir;
    }
    char get()
    {
        return bir;
    }
}
public class Person
{

    String name;
    Mydate birthday;
     Person(String name,Mydate birthday)
    {
        this.name=name;
        this.birthday=birthday;
    }
    public Person(Person p)
    {
        this(p.name,p.birthday);
    }
    public static void main(String args[])
    {
   
        Person p1=new Person("李小明",new Mydate("1979,3,15"));
        System.out.println(p1.name+p1.birthday);
        Person p2=new Person(p1);
        System.out.println(p2.name+p2.birthday);}
}
这咋不行啊!!请各位指点一下!!!
搜索更多相关的解决方案: class  

----------------解决方案--------------------------------------------------------
char bir;
    Mydate(char bir)
    {
        this.bir=bir;
    }
    char get()
    {
        return bir;
    }
类型错误,改成String

System.out.println(p1.name+p1.birthday);
        Person p2=new Person(p1);
        System.out.println(p2.name+p2.birthday);}
p1.birthday是一个对象,应该改成p1.birthday.get()
----------------解决方案--------------------------------------------------------
顶楼上

[ 本帖最后由 lampeter123 于 2010-4-15 21:42 编辑 ]
----------------解决方案--------------------------------------------------------
谢谢大家!!不好意思!!!又犯低级错误了!!呵呵呵呵
----------------解决方案--------------------------------------------------------
  相关解决方案