帮助解决小错误 - JAVA
您好,只是一个简单的问题..
我已经从已扫描的字符串构造了一个对象 clientdetailslist
ClientDetails clientdetailslist = new ClientDetails(client_ID,
title, initials, surname, clientname,
street, townorcity, postcode, clientaddress);
但是 new 之后的 ClientDetails 给出了错误,我不明白为什么。我认为这可能是班级的问题,但我很确定它没问题。任何帮助都会很棒,因为我真的不明白为什么:|
编辑:错误消息来自 NetBeans 阅读:
找不到符号符号:构造函数 客户端详细信息(java.lang.String 等 等)位置类:ClientDetails
PS 会发布图片,但我没有代表。
抱歉,如果信息不够。如果您确实需要更多,请发表评论,我会尽快提供。谢谢
Hi just a quick question..
I've constructed an object clientdetailslist from Strings which have been scanned in
ClientDetails clientdetailslist = new ClientDetails(client_ID,
title, initials, surname, clientname,
street, townorcity, postcode, clientaddress);
However the ClientDetails which comes after new is giving an error and I can't see why. I thought it might be a problem with the class but I'm pretty certain it's fine. Any help would be great as I really can't work out why :|
Edit : the error message is one from NetBeans reading:
cannot find symbol symbol: constructor
Clientdetails(java.lang.String etc
etc) location class: ClientDetails
PS would of posted a pic but I don't have the rep.
Sorry if it's not enough info. If you do need more just comment and Ill get it up ASAP. Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
也许是你的大小写(因为 Java 区分大小写)。客户详细信息 != 客户详细信息
Perhaps it is your capitalization (since Java is case sensitive). ClientDetails != Clientdetails
看来问题很可能出在 ClientDetails 类中。
创建自己的类时,它需要有一个构造函数方法,在本例中,它将采用以下形式:
Netbeans 错误是一个编译器错误,表明 ClientDetails 没有构造函数方法。因此,您尝试在 ClientDetails 类中实际存在的方法不存在的情况下调用 ClientDetails 构造函数。
要解决此问题,您需要访问 ClientDetails 以添加到构造函数中(或者如果存在则将其公开)。
It seems that the problem is most likely in the ClientDetails class.
When creating your own class, it needs to have a constructor method, in this case it would be of the form:
That Netbeans error is a compiler error that is suggesting that ClientDetails does not have a constructor method. Therefore you are trying to call the ClientDetails constructor without the method actually existing in the ClientDetails class.
To fix this you need access to ClientDetails to add in the constructor (or if it exists to make it public).