Hi ranchers,
if the code compiles, the
confserver object array must be non local.
Most probably the array is empty. If it is non local (i.e. an instance variable) it even may be not initialized.
In both cases (empty or uninitialized) a null pointer exception is thrown.
Simple example
Prints null
and then throws NullPointerException.
By the way, Krishna, you should give classes identifiers that start with an uppercase letter. Makes the code easier to read (for humans, not for compilers).
krishna balaji wrote
confserver is class in defined how to create array of the class ?
confserver obj[];
It is declared but not defined and filled yet, not even an empty array, but a reference to a confserver array.
Please put the brackets behind the class identifier
confserver[] obj;
would be the normal way to say this. The way you did it works, but is unusual and also harder to read.
obj is not a nice name for a variable. It tells you nothing.
Declare, initialize and fill an array, example:
Yours,
Bu.