Er... no.
You don't return anything from a constructor. That's why it has no return type.
There's no need to even have a constructor if you're not going to do anything with it.
Er... no.
You don't return anything from a constructor. That's why it has no return type.
There's no need to even have a constructor if you're not going to do anything with it.
Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!
Im doing somethign that makes me need to write a constructor that includes the name of a person, their address and income. How would i do that?
What do you mean it needs to "include" the name, address, and income of a person? You mean those details should be passed to it?Code:class Person { String name, address; float income; Person(String name, String address, float income) { this.income = income; this.address = address; this.name = name; } }
Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!
include meaning contain it. ( im really not sure). i think its saying that i need to have it in it. I think what you have might be what i need but i dont understand the this.income, this.address etc part.
Sorry to be so unclear about what i need. im not so sure myself.
Bookmarks