Parambir Singh

Ranch Hand
+ Follow
since Sep 05, 2004
Parambir likes ...
Android Java Ubuntu
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 Parambir Singh

Hi James

Let's assume that to stream the video on the homepage, you have to use an HTML tag such as

Now, if you want to write an EL function, it'll have to create the <video> tag using Java code. For example:



This is what option D is referring to. Now, if in future the video tag's attribute names change, you'll have to modify your EL function and recompile your code.

Hope it helps!
Importing a whole package can only make the compilation slower, not the execution of the program. The compiler searches for a class that you have used in your program in the classes/packages you have imported. Therefore, the more classes it has to search in, the more time it is going to take. However, I haven't seen it make much of a difference practically. It is more of a theoretical difference (in my experience).

What can affect you as a developer is the fact that importing whole packages can create unnecessary conflicts. E.g. there's a Date class in both java.util and java.sql package. If you are using some other classes from both these packages and instead of importing specific classes (java.util.Calendar), you import the whole package (java.util.* & java.sql.*), you can't simply use the Date class. You'll have to use the fully qualified name of the class (e.g. java.util.Date).
12 years ago
You always need to set some value for a variable before using it in any statement. If you are not sure what value to assign, you can initialize a variable to null:

However, you can't set the primitive types (int, float, boolean etc.) to null. So you'll have to initialize them to some value as per your program's logic (0 for int, false for boolean etc.)
12 years ago
Many congrats...
12 years ago
If an object of type A can be cast to type B, we can say that 'A is a B'.

E.g. Object o = new String();
Hence, String "is a" Object

Serializable s = new String();
Hence, String "is a" Serializable

And, Object o = s;
Hence Serializable "is a" Object

And in the last statement, s can be an object implementing any interface, therefore Interface "is a" Object is true.
Thanks Ritchie... I didn't know about these classes!
13 years ago

Campbell Ritchie wrote:If a singleton has only private constructors, you cannot extend that class.



Yes but we can have protected constructors.
13 years ago
This is a "standard dilemma" - whether to use static methods only class or a singleton. Both approaches are fine from a performance point of view. One advantages of a singleton approach can be that you can extend the class to implement some different functionality of the methods. With static method only class, there's no meaning of inheritance.
13 years ago
Since you'll be implementing HashTable and HashMap on your own, you can consider them to be the same. Hashtable (along with Vector) were the datastructures available in Java originally before the Collections API was introduced. Hashtable is thread safe (i.e. more than one thread can access/update it without and problems of data corruption). However, this degrades its performace. HashMap is not threadsafe. Infact, none of java collection APIs are thread safe.

You can consider using a combination of HashMap and List to store the data. The HashMap's key would be the string that you need to search for and the List can contain all the places that string was found.
13 years ago
Synchronized blocks are required when you want to prevent two or more threads to access a part of the code in simultaneously. Since you are only caching a JNDI reference, the only piece of code that will be run will be something like:



You don't need to synchronize this. And a singleton is a good choice for these kinds of scenarios.
13 years ago
As far as I remember, there's an expiration date on my certificate. I'll verify that and let you know.
The SCJP certification is valid for 3 years only, isn't it? Can we give SCWCD etc even after 3 years of clearing SCJP?
If they themselves have given you the date and time then no need to worry. But if you wish, give them a call and confirm your doubt. All the best for the exam!
Believe me, SCJP is easier than any of the mock exams. Chill
% is the prompt for the Mac OS.

It isn't required to display the path on the command prompt. It is only for the help of the user who is typing. The computer "knows" which folder you are in and runs the command in that folder itself.

You can configure the command prompt on Mac to display the path as well. Most people don't do it. It's just a matter of taste. To know which directory you are presently in, you can use the 'pwd' command. It stands for 'present working directory'

Hope it helps!
13 years ago