*
The moose likes Beginning Java and the fly likes Constructor Not Visible? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Constructor Not Visible?" Watch "Constructor Not Visible?" New topic
Author

Constructor Not Visible?

Arun Kumar Gaddam
Ranch Hand

Joined: May 05, 2007
Posts: 58
There is Class file called org.smslib.InboundMessage which i want to use in my Project.so Just I Instantiated the Class By calling the Constructor....But the error coming was Construtor is not visible.......The class Contained three Overloaded Constructors ,not single one responding....I saw the sourse too no constructor was private or default.........Then what would the problem...........

Any Body please tell me the mistake .............
Thanks in Advance....................
[ February 01, 2008: Message edited by: Bear Bibeault ]
Kaydell Leavitt
Ranch Hand

Joined: Nov 18, 2006
Posts: 688

If the class is in a different package, you'll have to import the class into your source file, using the keyword import.
Arun Kumar Gaddam
Ranch Hand

Joined: May 05, 2007
Posts: 58
I have done with all the imports,setting classpaths all the necessary things but invain......the problem is constructor not visible.............
Sunny Jain
Ranch Hand

Joined: Jul 23, 2007
Posts: 433

Did you check ..may be the class is abstract..!!
can you tell us what is the exact error you are getting..!!
paste the same error here..!!


Thanks and Regards,
SCJP 1.5 (90%), SCWCD 1.5 (85%), The Jovial Java, java.util.concurrent tutorial
Arun Kumar Gaddam
Ranch Hand

Joined: May 05, 2007
Posts: 58
Exact error is.............

Constructor InboundMessage(MessageTypes,String,int) is not visible
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38057
    
  22
Please post a bit of your code with the imports, class heading, the bit which isn't working, and the constructor and class heading for the InboundMessage class.
Mark Newton
Ranch Hand

Joined: Jan 31, 2006
Posts: 129
Originally posted by Campbell Ritchie:
Please post a bit of your code with the imports, class heading, the bit which isn't working, and the constructor and class heading for the InboundMessage class.


Also, since you said you have the code for the class you're trying to instantiate, it probably wouldn't hurt to have a look at that - at least the constructors that are not visible.
Petrus Pelser
Ranch Hand

Joined: Feb 20, 2006
Posts: 132
Have you checked if maybe the class contains a static method for retrieving an instance? Something like getInstance(), or getInboundMessage(), etc.
Arun Kumar Gaddam
Ranch Hand

Joined: May 05, 2007
Posts: 58


This is my code........



And this is the construtors code..........
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336


super(type, null, null)

The exception message is telling you that the constructor you call here is not visible, i.e. it is private or has package visibility. Are you sure the source you looked at is the source you are calling?

Because you pass null arguments, are you sure you are calling the constructor you think you are?
[ February 07, 2008: Message edited by: Paul Sturrock ]

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Constructor Not Visible?
 
Similar Threads
how to use the final class that has no constructor?
constructor doubt
Making Line in java
Clarifications/Suggestions in Java
Would you consider them Singletons?