The OCEJWCD is the Oracle's version of SCWCD (Sun Certified Web Component Developer) exam, which tests candidate's knowledge on Servlet, JSP, and other web technology. The OCEJWCD stands for Oracle Certified Enterprise Java Web Component Developer. Like other Java certifications e.g. OCAJP or OCPJP, the key to success is selecting a good book, practicing code daily, and then solving as many mock questions as possible. In the last article, I have shared some of the best OCEJWCD books and in this article, I am going to share of the best free OCEJWCD 6 mock tests you can online. These mock exams are good for self-assessment and practicing before real exams.
How do public static final variable works in Java? what is the difference between a public static final variable and a public final (non-static) variable in Java? Does both are same? It is one of the simple, yet tricky questions which may Interviewers like to ask candidates, and would you believe that almost 50% Java developers miss the key point to mention here, which we'll see in this article. In short, No, they are not same. Even though both are final variables and you cannot change their value once assigned there is a very subtle difference between them. A public static final variable is a compile time constant, but a public final is just a final variable, i.e. you cannot reassign value to it but it's not a compile-time constant.
Labels: core java
Suppose you have a double primitive variable 4.444 and you want to convert it to the integer value 4, how do you that in Java? Since double is bigger data type than int, you can simply downcast double to int in Java. double is 64-bit primitive value and when you cast it to 32-bit integer, anything after the decimal point is lost. Btw, type casting doesn't do any rounding or flooring, which means if you have 9.999999 and while casting to int you are expecting 10 then you would be disappointed, casting will give you just 9. If you need 10 then you need to use Math.round() method to first round the double value to the nearest integer and then truncate decimals.
Labels: core java