Win a copy of Head First Android this week in the Android forum!

Peeyush Bhadola

Greenhorn
+ Follow
since Jan 23, 2011
Peeyush likes ...
Chrome Java Windows
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
15
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Peeyush Bhadola

Thank you so much Winston. I tried it on JOptionPane's message dialog and it worked. Many thanks.
9 years ago
Ok so my question is when I instantiate java.util.Currency with US locale, the getSymbol(Locale locale) method returns $ as symbol. But when I use any other locale (say Japanese) it returns ? (question mark). Is there a way to get Japanese currency character(¥) just like I am getting in case of US Locale?



Peeyush
9 years ago
Anissa,
2 things to notice-
1. Your add() method inside Drink class is populating the instance variable "recipe" (present in class Drink).
2. But your printRecipe() method is displaying the local variable recipe" which is present in the main() method, as it is being passed a parameter in the method.

There are many ways to fix it .. one of the way is to replace in main method with this statement,
9 years ago
I am on chapter - 3 .. what's your doubt .. let's see if I can help.
9 years ago
Hi,

I am making a small application that connects to one or more printers present in network location in one go, esp in Windows as I am working on it. The reason behind making this application is to get the whole list of printers from shared location in the word processing application while printing a job. Can someone please help me in knowing which all java APIs I should refer to fix this problem. Please don't kill the suspense by giving me the code. I just want a hint or API reference.
Thanks.

- Peeyush
10 years ago
Hi Guys,
I have a small issue ... I am trying to create an applet(say Sample.java) with a JLabel component in it initialized with HTML string.

Sample.java:

Other thing I did is I have embeded this applet in an HTMML file(Sample.html).

Sample.html:


After compiling Sample.java, when I open Sample.html in Internet Explorer - for first time it shows the applet with label correctly, but when i refresh the browser again, applet appears but the label does not.
Same issue is working fine on firefox 3.6.13.

I want to know if I am making some mistake or is this issue related to jvm version. Please help.
Here are the versions for:
Internet Explorer - 8.0.6001.18702 and JVM - 1.6.0_23

Thanks.
10 years ago

Jared Malcolm wrote:I think you may misunderstand GC.


Hi Jared thanks for the explanation but I think you misunderstood me. What I was saying is,
At line#10, c1.go(c2) returns null and that means reference c3 has nothing to point. Therefore I wrote

Peeyush Bhadola wrote:At line#10: c3 = null. So there is no object present to be marked for GC.


Also, I am very much aware of the fact what you have mentioned:

Jared Malcolm wrote:if an object no longer has a reference pointing to it...that's the point at which it is ELIGIBLE to become GC'd


... and that is why i wrote :

Peeyush Bhadola wrote:At line#11: c1 = null. That means the remote control(reference) c1 is not pointing to any object and hence the object created at line#8 can be marked for GC.


And in case of reference c2, it is still pointing the object present in memory. So it can't be marked for GC.
10 years ago
When // doStuff is reached, I think things will be seen in this way:

At line#10: c3 = null. So there is no object present to be marked for GC.

At line#11: c1 = null. That means the remote control(reference) c1 is not pointing to any object and hence the object created at line#8 can be marked for GC.

At line#9: The remote control(reference) c2 is still controlling the object. So there is no point marking this object for GC.

This is from my understanding. So if you find any mistake in my answer, please help. Thanks
10 years ago
@Campbell - Yes ... I was wrong. Thanks
10 years ago
Hello Sami, I think you forgot to set the CLASSPATH variable, which is the most important activity to be performed while playing with packages. Here are the steps that can avoid NoClassDefFoundError :

Step 1. Create your program. (In your case it is Noose.java)

Step 2. Now put this file in a folder with name same as your package name. (In your case, the package name is moose). So you need to create a directory or folder with folder name as moose, and then put your noose.java inside this folder.

Step 3. [Main Step] Now set the CLASSPATH. Consider you are working on Windows and your newly created folder moose is present under C:\ directory. If this is the case then you need to set CLASSPATH using command prompt as: set CLASSPATH=.;C:\;
When you set classpath, Java will search our file in C-directory and also in current directory. This is because I have used .(dot) for current directory and C:\ for C directory.

Step 4. Compile the java file
C:\moose>javac Noose.java

Step 5. Run your program
C:\moose>java moose.Noose
10 years ago