raja kanak

Ranch Hand
+ Follow
since Oct 18, 2006
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by raja kanak

web page

Check the above url which gives details about K&B Book available in India.

Good luck
A sub-question

int[][] a = {{1,2,}, {3,4}};
After the above code, a is a two dimensional array and a[0], a[1] are one dimensional arrays. Am i right?

If I am right, is the cast necessary in the following line?
int[] b = (int[]) a[1];
Code is from javabeat

In the above code, if i uncomment //1 then it is compilier error. My doubt is, we can add anything into s (set of Objects), then why can't hs? (HashSet is subclass of Object)
Oops. You are right. Now I am clear. Thanks friends.
K&B Chapter 7: Generics and Collections, page number 594 says

public void AddAnimal(List<? super Dog> animals) is essentially, "Hey compiler, please accept any List with a generic type that is of type Dog, or a supertype of Dog. Nothing lower in the inheritance tree can come in , but anything higher than Dog is OK."

Im confused Can any body throw some light on this?

The above code breaks at //1
Object is super class of String, then why it is not compiling?
[ March 16, 2007: Message edited by: raja kanak ]

Thanks ShivKumar for your reply. As per your suggestion I modified my code as at //0 final int a; and at //1 included a=5 which gives compile time error "Cannot assign a value to final variable". So i commented //1 and again it complains that "variable a might not have been intialized".

That means we must initialize the variable a before the MethodLocalClass definition.

Again at //0 i removed final modifier, then the compiler error is "local variable a is accessed from within inner class; needs to be declared final"

Conclusion: To access a local variable inside inner class, that variable should be declared final as well as it should be initialized outside the inner class.

Please correct me, if I am wrong.


Originally posted by Jesse Custer:
You are reassigning a final variable. You cannot give 'a' a new value.

I changed //1 as

Still it is problem, "Identifier expected".

The code compiles
How can we use this interface & what is use of it?
(I feel it is silly question)

The above code shows error at //1 while compiling. I thought since a is declared as final, it can be used inside MethodLocalClass. But what went wrong?

Originally posted by Barry Gaunt:
Did anyone actually receive anything? If no answer, then we'd better close this thread. Nice collection of e-mails here for the spam crawlers to find.

You are right.

Hope the code above will help.