|
-
September 29th, 2011, 09:10 PM
#1
class extension
I am trying to call a class, and I keep getting a construct instead why? Is there a reason why this would keep happening? Just a list of some basic reason why this happens would be appriciated.
-
September 29th, 2011, 09:48 PM
#2
Re: class extension
could you supply the code that's giving you trouble and the result.
-
September 30th, 2011, 09:12 AM
#3
Re: class extension
How are you "calling" a class? Do you mean you are trying to create an instance of the class?
Or to call a method in a class?
Norm
-
October 1st, 2011, 11:54 AM
#4
Re: class extension
 Originally Posted by kolt007
I am trying to call a class, and I keep getting a construct instead why? Is there a reason why this would keep happening? Just a list of some basic reason why this happens would be appriciated.
Can you provide some more details e.g. how are you calling class, what error are you getting , better paste the error it would be quick to solve.
-
October 1st, 2011, 06:19 PM
#5
Re: class extension
First class:
Code:
public class client extends Player implements Runnable {
//code here
}
Second class:
Code:
public class OBJECTS2 extends client {
//code here
}
Error Thrown:
Code:
OBJECTS2.java:2: error: constructor client in class client cannot be applied to
given types;
public class OBJECTS2 extends client {
^
required: Socket,int
found: no arguments
reason: actual and formal argument lists differ in length
1 error
Finished!
Press any key to continue . . .
-
October 1st, 2011, 06:30 PM
#6
Re: class extension
You need to post all of the code for all of the classes. Your edited,shortened code samples are useless.
Norm
-
October 1st, 2011, 06:40 PM
#7
Re: class extension
This code compiles with no errors:
Code:
public class InheritanceTest {
class Player {}
class client extends Player implements Runnable {
//code here
public void run(){}
}
class OBJECTS2 extends client {
//code here
}
}
Norm
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|