Rajat Jindal

Ranch Hand
+ Follow
since Sep 19, 2011
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
2
Received in last 30 days
0
Total given
5
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Rajat Jindal

Thanks Winston Gutkowski and Campbell Ritchie !!

Actually I am reading Thinking in Java 4th Edition and it is mentioned :-

EnumSets are built on top of longs, a long is 64 bits, and each enum instance requires one bit to indicate presence or absence. This means you can have an EnumSet for an enum of up to 64 elements without going beyond the use of a single long.



/* Output:
[A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22, A23, A24, A25, A26, A27, A28, A29, A30, A31, A32, A33, A34, A35, A36, A37, A38, A39, A40, A41, A42, A43, A44, A45, A46, A47, A48, A49, A50, A51, A52, A53, A54, A55, A56, A57, A58, A59, A60, A61, A62, A63, A64, A65, A66, A67, A68, A69, A70, A71, A72, A73, A74, A75]
*///:~
The EnumSet clearly has no problem with an enum that has more than 64 elements, so we may presume that it adds another long when necessary.

Queries:-
1. Can someone please explain about these 64 bits concept here. Still more than 64 elements can be represented... ???
2. EnumSets are used in place of flags. That statement is also not very clear to me.
7 years ago
I have few queries related to enum and EnumSet:-

1. When to use EnumSet, any specific example which shows EnumSet is required.
2. Whats the meaning that Enum Constants are not compiled into clients so you can freely add, remove, or reorder them without recompiling the clients? Hoiw is it possible to add new values without compiling the code.
3 Can someone please explain this:- Enum sets are represented internally as bit vectors.

Thanks in Advance!!
7 years ago
Welcome Joel. I am eager to know what's new in this edition!!
7 years ago
I would recommend Core Java from Cay Horstmann. Nice book!!
7 years ago
try this link:-
Its free on youtube and moreover it will give you a good overview on java ee. It has some struts stuff also, hope you will like it

javabrains.koushik.org/
7 years ago
Hats off to all of you. I got the answer. thanks
7 years ago
hi,

I came across a code where the exceptions can be thrown from catch and finally block too. I never gave a thought on what scenarios that can be required. Can anyone provide some practical examples when/where it can be required to throw the exception from catch and finally blocks.
7 years ago
It seems one of files is missing which you are using as in import or some jar library is missing.

check the following link

http://stackoverflow.com/questions/12496492/javax-servlet-unavailableexception-after-an-upgrade-to-was-7
8 years ago
JSP
One basic thing you can note down here:

what functions king will perform will be methods like:
hearProblemFunction();
givingSolutionFunction();

the state will become in which King/officers are present like:
busy, free



So if you will see the functions performed by someone are actually methods and states in which someone is present become variables.
8 years ago
Write your code here and this forum will help you in making it better and first you will have to try.
8 years ago


Line18 i.e "//4" will give you compile time error:



Important point is that whenever you will call the method polymorphically than you will need to either throws the exception or will need to write it in try-catch block.

8 years ago
If we make a class as "protected", I know it's not a good programming practice to have a class as "protected" but I don't understand why it is not allowed. Since "protected" lies between "public" and "default" access specifier. What's made Sun to remove "protected" from class level access specifier. Please give me some relevant information. Thanks in Advance.
Please don't mention answers like what's the use of having "protected" as a class level access specifier.
9 years ago
Why "protected" can't be used as access modifier at class level whereas "default" can be used which is more restrictive than "protected" ? For example:-




9 years ago
@Campbell Ritchie... Thanks for correcting me... yes class will not compile... :-)
10 years ago