This week's book giveaway is in the Spring forum.
We're giving away four copies of Modern frontends with htmx and have Wim Deblauwe on-line!
See this thread for details.
Win a copy of Modern frontends with htmx this week in the Spring forum!

Balraj Momi

Ranch Hand
+ Follow
since Jul 23, 2009
Balraj likes ...
Java
Merit badge: grant badges
For More
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 Balraj Momi

Now I have no idea what made it to work now . I can see IllegalStateException after I put try-catch block.
Earlier It was blindly going to forwarded url.

But anyway thanks much for looking into it.
Welcome Simran
This is one place where you can find all the help you want
HI
I tried this example to flush PrintWriter/ServletOutputStream and then forwarding it to another jsp. I was expecting it to throws IllegalStageException, but it worked fine in both cases. Could anyone please tell me what am I be doing wrong here.
Thanks in advance
You have to fix your imports, Statement interface is inside java.sql package.
So fix it by by changing it to java.sql.* as below.
What error you are getting?

Change this

to


and move it to top of the jsp.

Hopefully this might help
Anastasia is right, there are 3 objects eligible.
It will be 4 If gb1 is assigned to null.
b or B -> will return false for anything that is null or false (boolean or Boolean)
For everything else It returns true e.g. 978, 654, abc, sdf, etc. etc.
I think four objects are eligible for GC.
A[] aa1 = (A[]) r1 //Illegal

I think above is Illegal because r1 is just an Interface reference type,not of type array.

ra1 = (Runnable[]) ca; //Illegal

In this case also same situation holds good. If you want to make this work change ca to array type and make C a non final class. OR typecast ca to just Runnable reference by making C a non-final class.
My Friend, object creation happens at Runtime not at Compile time.

Read this Generics Super and Extends

you will get full insight what I was trying to say. Go through this, then come back If you have any question on this.


"Says this reference can be initialized with Animal or anything that extends Animal e.g. CAT, DOG, etc. This was about initialization.

But once initialization is done, compiler has no idea what this reference is initialized to, It can be anyone from CAT, DOG, or Animal. Since It is not sure that what object type is this, compiler gives compilation error.



Here both threads are created inside main method and will be having same priorities as main method. Do a small change, change second thread's priority to higher than first one, make called method non synchronized and add a tiny sleep in run method. You can see yield method in action.
Thats Correct, Answer is 0.

Here even though setNull() method is marking references to null, that is no way affecting reference inside caller method. Remember called method can only change values inside the passed reference type, It can not re-assign It to any new object or make it null.
Congrats Nitish, Great Score Buddy

Now when can access the certmanager site and see the results?



You will get an email from Sun, It will have a link in it, just follow the instructions.
14 years ago

So how does the 'toString' method gets activated?


If you put any reference type inside System.out.println() It tries to call toString() method of that object type inside that reference. Unless that reference type is null, you will get some String as output.

Now coming back to your question


You got following output

Your choice: This is a Cat
It's C the D


because On line1 you are first called super class's toStrng() method inside Cat's toString() method.

Regards