You are getting a null pointer exception because you have not instantiated
the object yet.  An object must be instantiated before it can be used.  This
is very fundamental and you should really spend some time getting to grips
with this.

The first line of your code declares a reference called samp of type
InterfaceSample.  This is fine.  It then sets the reference to point at
null.  This means you have a reference but no object upon which to call
methods.  You must set the reference equal to the address of an object
before you can use it rather than null.  e.g.  Sample samp = new Sample();

In your case this will not work however because you are using an interface.
An interface cannot be instantiated i.e. you cannot create an object of that
type by using new.  If you want the reference to be the type of the
interface, you must make it point to an object that implements that
interface

e.g.

SampleInterface samp = new SampleImplementation();
samp.getData();

The class SampleImplementation must be provide implementations for all of
the methods declared in SampleInterface and it must be declared using the
following:

public class SampleImplementation implements SampleInterface

I hope this helps



-----Original Message-----
From: Ramesh Nuthalapati [mailto:[EMAIL PROTECTED]]
Sent: 16 October 2001 11:06
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: (ROSE) Interface - subsystem




Hi all

I have an interface. i have implemented this interface in a sub system. so
my class should access the interface methods which are implemented in the
subsystem. when i am trying to call methods 

InterfaceSample samp=null;
samp.getData();

when i used this in my class it says "NULL" and is throwing exception.

Please help me in this issue. how do i call methods which are implemeted in
my subsystem through interface.

everything i have kept in a package.


Thanks in advance
Ramesh Nuthalapati. 

************************************************************************
* Rose Forum is a public venue for ideas and discussions.
* For technical support, visit http://www.rational.com/support
*
* Admin.Subscription Requests: [EMAIL PROTECTED]
* Archive of messages:
http://www.rational.com/support/usergroups/rose/rose_forum.jsp
* Other Requests: [EMAIL PROTECTED]
*
* To unsubscribe from the list, please send email
*
* To: [EMAIL PROTECTED]
* Subject:<BLANK>
* Body: unsubscribe rose_forum
*
*************************************************************************


___________________________________________________________________________
This email is confidential and intended solely for the use of the 
individual to whom it is addressed. Any views or opinions presented are 
solely those of the author and do not necessarily represent those of 
SchlumbergerSema. 
If you are not the intended recipient, be advised that you have received this
email in error and that any use, dissemination, forwarding, printing, or 
copying of this email is strictly prohibited.

If you have received this email in error please notify the SchlumbergerSema Helpdesk 
by telephone on +44 (0) 121 627 5600.
___________________________________________________________________________

************************************************************************
* Rose Forum is a public venue for ideas and discussions.
* For technical support, visit http://www.rational.com/support
*
* Admin.Subscription Requests: [EMAIL PROTECTED]
* Archive of messages: http://www.rational.com/support/usergroups/rose/rose_forum.jsp
* Other Requests: [EMAIL PROTECTED]
*
* To unsubscribe from the list, please send email
*
* To: [EMAIL PROTECTED]
* Subject:<BLANK>
* Body: unsubscribe rose_forum
*
*************************************************************************

Reply via email to