Janaranjani K

Greenhorn
+ Follow
since Jan 20, 2006
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Janaranjani K

Hi Ranchers,
I successfully completed the SCJP 1.5 with the score 97%. Thank you all for clearing my doubts. My sincere thanks to Kathy and Berts for providing us a wonderful book for the certification.

For the folks who are going to give their exam: Have Hands-on on each and every Objective and clarify all your doubts even if it is silly ones ;-)).... never mind asking those ok :-)))) ... All the very Best



Thanks
Janaranjani
14 years ago
Hi everybody,
I'm new to this Corba world. I'm facing an issue while binding a name to an Object. The code is :

NamingContext ncRef = NamingContextHelper.narrow(ncObj);// ncObj- stringification of IOR.
System.out.println("2....The Naming context is : " + ncRef);

System.out.println("Creating NameComponent array...");
NameComponent[] nc = parse(config.getCorbaContext());

System.out.println("Bind the Object Reference in Naming...");
ncRef.rebind(nc, href);


The error i got during execution is:


ERROR: IDL mg.org/CosNaming/NamingContext/NotFound:1.0
org.omg.CosNaming.NamingContextPackage.NotFound: IDL mg.org/CosNaming/NamingContext/NotFound:1.0
at org.omg.CosNaming.NamingContextPackage.NotFoundHelper.read(NotFoundHelper.java:72)
at org.omg.CosNaming._NamingContextStub.rebind(_NamingContextStub.java:159)
at com.qwest.ums.umsim.UmsSimulatorServer.main(Unknown Source)


Please help me out...

Thanks in Advance :-)
15 years ago

Originally posted by Deepak Jain:
Here tea and coffee are actually "public static final" references to the object of type drink



They are reference variables which refer to the object of type drink. So you can change the value of the Object (i.e., Object's state is changeable), but can't assign different object to them (illegal, since they are declared final).
It won't be menitioned in the question.

Ranjani
It is because of the curly brace at line 7. At line 3, instead of semi colon, a open curly brace is used, because of that the compiler reports that semicolon is missing at line 8, since the block opened at line 3 ends at line 7.
Hi uday,
I've a doubt in boxing and widening..
In K&B book, its given that, "You CANNOT Widen and then Box(An int can't become a Long)" in page no. 244. My view is , generally, you can widen an int to long or double, then you can use the wrapper utility to convert the same to Long or Double object. If this is possible then, why not Widen and then Box. If my understanding is wrong, please clear this point to me.
Hi everybody.
I'm facing some problem while executing the following program.......


import java.io.*;
public class InterpretProgram
{
public static String readStream(InputStream stream)
{
String output = "";
try
{
BufferedReader input = new BufferedReader(new InputStreamReader(stream));
String temp = "";
while ((temp = input.readLine()) != null)
output += temp + "\n";
input.close();
}
catch (IOException ie)
{
}
return(output);
}
public static void main(String[] args)
{
try
{

Process p = Runtime.getRuntime().exec("cat>sample.txt");//is this possible.

System.out.println("Output: " + readStream(p.getInputStream()));
System.out.println("Errors: " + readStream(p.getErrorStream()));
}
catch (IOException ie)
{ }
}
}

If not how can i use exec() to execute the command cat>sample.txt


Thanks in advance
16 years ago
thanks okay ,then how can i convert a String object into a int
16 years ago
How to convert a bytearray into a single integer.
16 years ago
a4.Perimeter(int s1, int s2)-------the error is here.
{
int perimeterRect=0;
perimeterRect=2*(s1+s2);
return perimeterRect;
}
It should be
public int Perimeter(int s1,int s2)
{
//your code....
}

Try to follow the name convention specified in Java i.e method's name should start with small letter.

Code will execute if you don't follow also.......but that is not a good programming practise.
16 years ago
Abstract follows Strict Class Hierarchy but Interface doesn't.If a method with in a Abstract class is found to change with time,then it should be put in Interface.So that according to the situation,you can define that method by implementing it.

Methods within an Abstract class can be either Concrete or Abstract.
Whereas Methods within an Interface is always Abstract(and public)
16 years ago
Hi everybody
Though it is silly question,it is really a headache for me.For what purpose we need these files.I know the expansion of JAR(Java ARchive).What's the expansion of EAR.When they are used and where.


thanks in advance
16 years ago