Java构造函数,代码及错因如下,求大神指点

public class text {

public static void main(String[] args) {

People people=new People("liu",12);

people.info();

}

class People{

public String Name;

public double Age;

public People(String name,double age){

Name=name;

Age=age;

}

public String getname(String username){

return username;

}

public double getage(double userage){

return userage;

}

public void info(){

System.out.println("我是"+getname(Name)+"。今年"+getage(Age)+"岁");

}

}

}

错因如下:

Exception in thread "main" java.lang.Error: Unresolved compilation problems: 

The constructor text.People(String, String) is undefined

The method Age() is undefined for the type text.People


at text.main(text.java:8)


慕盖茨2165817
浏览 1333回答 0
0回答

慕瓜9220888

MNMHMPSIOQLUXGGXUEKCXFTWWTCUOAPOVFHTXCRCRRUXXRYKCXKKWGGUHGENAGTJEJBTKNKKRLNSHOHKTGJHZYROEKMHJHZSUAGWTCRCSPPVIWLDJZLYLXIDYANJWJVQMLDWZJPQRWKFMCPYXEQIUAIEYDHPEGEXNKCHGEDMZZLPKPKJZKGQCGIHPBOOLQRQRQZTWVVETSBUXHFFAPORHVCCTOTFKNJBOIWONPYVYRNYKDMFVIRNYNINHATZEIEFSCSIOSWOAVLOHEMNVXPVCVYRCFUGNQTJYZYAYYBGFRZRGRUEDKYKJIHXYOFDBGVXNQWPYMOIDJZWICNCKMWCVVURTIUHNQGRMHTAJSMPCRZOAZMJSWRPTILLBUACBGVBVGPJEWBTWZFSCGFNPPYBYEWLRKDTUUNYQVNYRUKMKZLAWPJSAYPXFVRRESGRZOHSKKGUVUMFPLRUVXSEXXAZNYNPRWLEHLPONLVHXDFZYASLRUOBWYAVGTGWNBUJLMCTKNFXZBXANGRCUMVJSLCFZYTSBELOSDGFHKADZBMOHCZSFHMLAJRUHRUWDPOGYKXXCUMKZSLYSVNONSLRRLXYXYTCFPPNLMLNGMPMVDYDCVLXKSNCAMSEBHVRNPPOIZZUPXZXRAKKKVNBXDWZWYFYDEHRUNOCNKMFIYLRIKPRNDGAZAKPBKRHDDVNMYJISFUSHPXKKWJLCRJLBAKWZUFFKYVLMYCMBNGMPMCDBQMNQDMYZXZVL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