• Post Reply Bookmark Topic Watch Topic
  • New Topic

No Valid constructor error, even with default constuctor

 
Aditya Vasishth
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
The following code is giving me the error:

java.io.InValidClassException: test; test; no valid constructor.

I don't know why the code is giving me this error, inspite of the presence of the no argument constructor in the class test.

Can anybody please help me to sort out this error?

Thanks in advance.

The code follows:





[ August 15, 2007: Message edited by: Joe Ess ]
 
Joe Ess
Bartender
Posts: 9362
11
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the JavaRanch. Have a look at our FAQ, How To Ask Questions On JavaRanch. It has helpful information like how to Use Code Tags, which preserve the formatting of your code.
As for your question, the JavaDoc for java.io.Externalizable states:
When an Externalizable object is reconstructed, an instance is created using the public no-arg constructor

Your no-arg constructor is not public.
 
prakash chandra
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I copied the whole source code. It compiles and run successfully without any modification and the output is "This is the writeExternal for the test class". I think your JVM is of lower version. Mine is 1.5.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!