Article View: aus.computers.java
Article #805Re: Constructors
From: Tom Davies
Date: Sun, 23 Apr 2000 00:00
Date: Sun, 23 Apr 2000 00:00
46 lines
2474 bytes
2474 bytes
If you have two methods (constructor or not) in a class which both have identical signatures (i.e. same name, return type and arguments) how can a client of the class specify which one to call? It just doesn't make sense. I don't see what you want to accomplish with the code after the //now... line. Tom Jonathon Bates wrote: > > Hi All, > I have a quick question in regards to constructors! > When compiling a class file, I get the following error: > > [batesy@batesy assignment2]$ javac as2q1class.java > as2q1class.java:68: Duplicate method declaration: as2q1class(int) > public as2q1class(int theassign_two) > ^ > as2q1class.java:77: Duplicate method declaration: void set(int) > public void set(int newassign_two) > ^ > as2q1class.java:83: Duplicate method declaration: as2q1class(int) > public as2q1class(int thetest_one) > ^ > as2q1class.java:92: Duplicate method declaration: void set(int) > public void set(int newtest_one) > ^ > as2q1class.java:98: Duplicate method declaration: as2q1class(int) > public as2q1class(int thetest_two) > ^ > as2q1class.java:107: Duplicate method declaration: void set(int) > public void set(int newtest_two) > ^ > 6 errors > > Now I am soooo far lostand I dont know why! > I have both the class + the client file located at > http://batesy.iinet.net.au/java/problem/ > > If someone could please provide some feedback It would be greatly appreciated! > I was under the imporession that the code was all correct! > > Cheers > Jonathon Batesy
Technical Details
Message-ID:
<39035EE0.77E570EC@smartchat.net.au>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<3902becc$0$20235@echo-01.iinet.net.au>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10d6db,ba8cc3bfd1429785 X-Google-Attributes: gid10d6db,public From: Tom Davies <tom@smartchat.net.au> Subject: Re: Constructors Date: 2000/04/23 Message-ID: <39035EE0.77E570EC@smartchat.net.au> X-Deja-AN: 614582420 Content-Transfer-Encoding: 7bit References: <3902becc$0$20235@echo-01.iinet.net.au> To: Jonathon Bates <batesy@batesy.iinet.net.au> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@connect.com.au X-Trace: merki.connect.com.au 956485230 6658 210.8.3.62 (23 Apr 2000 10:20:30 GMT) Organization: Customer of Connect.com.au Pty. Ltd. Mime-Version: 1.0 Reply-To: tom@smartchat.net.au NNTP-Posting-Date: 23 Apr 2000 10:20:30 GMT Newsgroups: aus.computers.java