| [+] Programmer Certification (OCPJP) » String variables (Go to) | | Henry Wong |
A null-pointing String reference when asked to cough up its String value with the + op, returns the literal 'null'. When any method is invoked though, there has to be a valid object to the ref. |
| [+] Programmer Certification (OCPJP) » Inner class - question in K&B (Go to) | | Barry Gaunt |
Originally posted by marc weber: The code you've posted has: One misplaced brace.One missing brace.One extra parenthesis.A misspelled class name (twice).A call to a method that doesn't exist. And NOT posted in the code block. |
| [+] Meaningless Drivel » Friday, the 13 (Go to) | | Dave Lenton |
Originally posted by Arun Kumarr: I would split it as paras(may be parasites shortened) - kave (may be from kava, a alcoholic drink) - deka(10) - tria 3) - phobia(fear). How do I decipher it, Is it fear of Drinking kava becuase 13 parasites will attack you? Okay Ash, what the hell is, paraskavedekatriaphobes? [ April 15, 2007: Message edited by: Arun Kumarr ] I thought the context made it clear? |
| [+] Meaningless Drivel » real jokes (Go to) | | Raghav Sam |
Originally posted by marc weber: Well, that's easier to explain than the studded leather underwear. Oh, wait... Those are dry clean only.  |
| [+] Java in General » String - the proto-auto-boxer! (Go to) | | Alan Moore |
Originally posted by Ilja Preuss: There is no string primitive. You might confuse it with String literals, which are objects, too. Try System.out.println("I'm an Object!".length()); Hey, I didn't mean there was one! But the autoboxing feature seems to give a certain transparency to the use of primitives and their wrappers, it's as though something like that already existing with strings. |
| [+] Meaningless Drivel » Friday, the 13 (Go to) | | Dave Lenton |
So how many of you are paraskavedekatriaphobes?? |
| [+] Java in General » String - the proto-auto-boxer! (Go to) | | Alan Moore |
After reading the discussion about autoboxing in this thread, I got to thinking that what the Javagods have come up with as autoboxing can be considered to have kind-of existed even earlier, with the String class. Here is the "alternate theory": is essentially a wrapper class for a primitive type called string. Comments. This perspective might help people trying to grapple with the intricacies of autoboxing (such as the one discussed in that thread) in light of known existing behavior - that of String. Comments. |
| [+] Programmer Certification (OCPJP) » Generics on Exam (Go to) | | Deepak Bala |
Most of the developers said so! You can look for arguments on the web about the developer community's reaction to the introduction of generics into Java. Sorry no time to look up some links for you, but when there's google there is ... |
| [+] Programmer Certification (OCPJP) » How to sort Map? (Go to) | | Arad Chear |
That seems to be a good way of doing it. I hope I don't find it too tedious to spawn another thread in an adjacent forum and the forum software we use makes it quite easy (lazy me  ) Cheers. |
| [+] Programmer Certification (OCPJP) » Hello and intro or is it re-entry? (Go to) | | Richard Boren |
We stand warned!! Or, cower..? |
| [+] Programmer Certification (OCPJP) » Please tell me, am I right or wrong. (inner class) (Go to) | | Pankaja Shinde |
Unless Inner is also a subclass of Outer. |
| [+] Programmer Certification (OCPJP) » Runtime & Compile time Error (Go to) | | Gaurav Pavan Kumar Jain |
This is a general programming concept. Most simply: A compile-time error is a problem found at compile time. A runtime error is anything that goes wrong at runtime -- in Java, runtime errors are usually indicated/communicated via exceptions (Throwable and family). |
| [+] Programmer Certification (OCPJP) » Generic Question Doubt (Go to) | | Chandra Bhatt |
| |
| [+] Programmer Certification (OCPJP) » Doubt in Overriding Static Method....? (Go to) | | Keith Lynn |
Overriding is an object-oriented feature and is connected with class families and polymorphism. Static members are theoretically outside the bounds of pure OO. Read up on this and you will see light! |
| [+] Programmer Certification (OCPJP) » How this assignment is possible...? (Go to) | | Mike Petrogeorge |
What makes you think this shouldnt work? That might help us find an answer. |
| [+] Beginning Java » A can full of Beans (Questions) (Go to) | | Stuart Ash |
Avoid the Heinz one and you ll be fine  |
| [+] Programmer Certification (OCPJP) » Exception (Go to) | | Chandra Bhatt |
| |
| [+] Programmer Certification (OCPJP) » How to sort Map? (Go to) | | Arad Chear |
Thanks Bert for the explanation. Point taken. In fact, this dawned upon my mind (at least my subconscious mind!) after I asked the question here. I agree -- and wholeheartedly, that the idea of this forum is to exercise one's own algorithmic skills within the bounds of the set objectives. I was more in a developer mode than a certificate-aspirant one. I will recalibrate accordingly. However, I reserve my old stand for just one reason: to those who may be willing to, poring over such pre-written code might give valuable ideas. Of course, only Javafolk who have adequate experience in development would be amenable to doing this, and it seems to me that there are many here -- without being disparaging, who have less than a long-standing development experience. So, I guess I should mention such other pointers with the appropriate caveat! |
| [+] Programmer Certification (OCPJP) » default package? (Go to) | | Stuart Ash |
Originally posted by Remko Strating: With the default package I mean there is no package defined. So the compiled class file will be in the same directory. Stuart Ash has explained everything clear for you. He has done a good job. Thank you Remko  and Patrick for seconding  |
| [+] Programmer Certification (OCPJP) » Mock question for static method? (Go to) | | Stuart Ash |
| |
| [+] Programmer Certification (OCPJP) » Mock question for static method? (Go to) | | Stuart Ash |
Didn't we discuss this before? Am I getting a deja vu !! |
| [+] Programmer Certification (OCPJP) » Why compiler error? import (Go to) | | Chandra Bhatt |
Because two instances of Inner are created! The catch is here: InnerMost extends Inner When the Innermost() constructor is getting executed, it is first creating a subobject of Inner (because Inner is its parent), which brings in an extra increment! |
| [+] Programmer Certification (OCPJP) » Can Constructor be synchronized? Why? (Go to) | | Chandra Bhatt |
Consider this code. The idea of synchronizing is to ensure that, two threads, say t1 and t1, do not execute the save method on an instance of this class, at the same time. No think if this requirement holds for a constructor. At construction time, is there possibility of a conflict as described above? And you will have the answer. Cheers. |
| [+] Programmer Certification (OCPJP) » Exception Question (Go to) | | raj malhotra |
Originally posted by Chandra Bhatt: Thanks Keith, and Krishnan! Any unchecked exception is free from all the discussed bondage. Bondage lol Indeed! "Man is born free and everywhere there are checked exceptions!!" > Apologies to Rousseau.  |
| [+] Programmer Certification (OCPJP) » Question: Source Javacertexam (Go to) | | Chandra Bhatt |
Originally posted by Chandra Bhatt: My Question 2 : What is meant by custom order? If I am true, for this we need Comparator interface implemented by third party class. Answer is given "D" How long "A" is correct. I checked it thinking Date and String are not Wrapper classes. Thanks, cmbhatt Natural Order: As imposed by Comparable intrinsically, i.e., within the class. Custom Order: As offerred by Comparators extrinsically, i.e., Comparator implementations outside the class. Does this throw some light on your query? |
| [+] Programmer Certification (OCPJP) » Set Question: source Javacert (Go to) | | Sourin K. Sen |
Maybe since C is "truer" than A, C de-trues A ??  |
| [+] Programmer Certification (OCPJP) » How to sort Map? (Go to) | | Arad Chear |
Originally posted by Bert Bates: Also, let's make any Apache code "out of bounds" for a discussion in the SCJP forum :roll: Why??  |
| [+] Programmer Certification (OCPJP) » How to sort Map? (Go to) | | Arad Chear |
The code posted by Saqib is not 100% Java5. Can you convert it to complete Java 5 (if you are taking the J5 exam)? |
| [+] Programmer Certification (OCPJP) » How to sort Map? (Go to) | | Arad Chear |
If you want to discuss the implementation of a new algorithm for this (instead of using the lovely apache commons code), you can rest assured I won't be as fast as electricity .. let's see... can we use something other than a hashmap? I can think of storing Map.Entry objects (if the HashMap object is already given to you, get the Entry object Set using the appropriate method) in a List and sorting that list by using a custom Comparator which helps sort by Entry values. Hope I am clear with the basic idea, but this is just a thought running in my head and I haven't considering all aspects of implementing it, but maybe you want to try some code taking this as a cue and we can discuss it further? |
| [+] Programmer Certification (OCPJP) » How to sort Map? (Go to) | | Arad Chear |
... right, if you want to sort by values, consider a BidiMap implementation in the Apache Collections API: Commons Collections Cheers |
| [+] Programmer Certification (OCPJP) » How to sort Map? (Go to) | | Arad Chear |
Sorry your question is not clear to me. Do you wish to sort based on keys or values? If it's keys, it's quite simple, just use a TreeMap. But it it's about sorting by the values, hmm... |
| [+] Java in General » I8N for all data (Go to) | | Mathias Nilsson |
Some more information on how the two applications interact, and other such detail might be helpful. |
| [+] Programmer Certification (OCPJP) » Doubt in java identifiers? (Go to) | | Stuart Ash |
Thanks Faisal. It's not an original though, I just encoded it into ASCII  |
| [+] Programmer Certification (OCPJP) » Doubt in java identifiers? (Go to) | | Stuart Ash |
It goes back to earlier times than when Gosling fathered his baby. The simplest reasoning could be: because then, you might try to do something like: Try some rumination on this here. Cheers. |
| [+] Programmer Certification (OCPJP) » Doubt on protected (Go to) | | Stuart Ash |
Essentially, protected is less 'private' than package, so any member that is protected is also accessible as if it were a 'package' variable. private > 'package' > protected > coderanch. |
| [+] Programmer Certification (OCPJP) » simple prog. (Go to) | | Lovleen Gupta |
Y is 0 at the point when x is being inited, but subsequently it does get assigned to 5, which you can confirm by printing y's value directly in the main. |
| [+] Programmer Certification (OCPJP) » default package? (Go to) | | Stuart Ash |
I think there is a confusion here: about default the concept and default the keyword. The 'default' keyword applies only in the case of a switch-case construct. When talking about default packages (and access specifier), default means the 'absence' of any keyword or identifier. So, in common parlance, when you say default package, it means unnamed package. There is no question of using the string 'default' to name it. cheers. |
| [+] Meaningless Drivel » Is there MSG in India? (Go to) | | Chetan Parekh |
Hello drivelers, It's been a long time... MSG is monosodium glutamate, a flavor-enhancer, typically used in Chinese dishes. This gives them what's called the umami taste, which makes Chinese/Oriental soups taste better/fuller than otherwise. It's commercially available as Ajinomoto, which is a Japanese term meaning the "essence of taste". あじのもと. Many people, however, cannot stand it and are alergic to it. Cheers. |
| [+] Java in General » Bluetooth programming using J2SE (Go to) | | Rob Spoor |
A curiosity: since USB is a standard, I wonder why the Java team did not come up with a javax.usb API. Has there been any discussion of any such thing that someone here knows of? Cheers. |
| [+] Beginning Java » J2SE or J2EE (Go to) | | Stuart Ash |
It may be added that J2EE is a superset of J2SE, and you will perhaps move on to it as advance in your Java learning. |