Sunday, June 29, 2008

Rules for legal identifiers...


The SCJP exam wants you to know perfectly the rules which define legal and illegal identifiers names. Make sure you know this perfectly as there is no excuse for this. Read the following carefully and you will understand it's not that difficult:

Rules for Legal Identifier Names:

1. Identifiers must start with a letter, a currency character ($), or a connectingcharacter such as the underscore ( _ ). Identifiers cannot start with a number!

2. After the first character, identifiers can contain any combination of letters, currency characters, connecting characters, or numbers.

3. In practice, there is no limit to the number of characters an identifier cancontain.

4. You can't use a Java keyword as an identifier. Following figure lists all of the Java keywords including one new one for 5.0, enum.

5. Identifiers in Java are case-sensitive; so pen and PEN are two different identifiers.

The list of Java 1.5 Keywords follow -

Some of the legal identifiers are:

$aturn, _$23, _23, $_aturn, there_is_no_limit_to_the_number_of_characters

Some illegal identifiers are:

23$, -saturn, :saturn, saturn#, .saturn

If you have any questions...let them come through the comments, I will gladly answer each one of them.

Friday, June 27, 2008

Java is pass by value.....Always! - Part1


Surprised? Well, lets look at what is pass by value and pass by reference. Let us understand first what is a value and what is a reference. A value of any variable/or java object is the value assigned to it....huh...now what does this means? More technically, a variable is nothing but a name given to a memory location and the value of x is what is stored at the memory location of x. A reference is a pointer to an object. Say its like a remote control through which you can handle the target object. Take help of following figures...

Variable X storing value 7

Reference X storing a remote control

Clearly understand the difference between a value and reference and then you can understand what is pass by value and pass by reference. Well basically as far as java is concerned there is no difference!!Thats why I said java is pass by value always. Let's see why there is no difference. In a pass by value you always pass the underlying value of that variable...that means what ever is stored at the memory place. So if X is a variable and it has value 7 then the memory location contains the number 7. And when you pass by value you actually pass what is stored in the memory..and so 7 is passed! When X is a reference then also same thing happens...whatever is stored at the memory location is passed. But hey wait..in earlier case memory contained 7, but what is here? Here X is a reference, hence it contains a remote control to someone whom it is pointing to..so the memory contains the remote control! So here the remote control is passed! In both cases the value is passed, in first case the value is the actual value and in next case the value is actually the remote control. When you pass the remote control the entity (to which you are passing the remote control) can manipulate the object. In the next post I will demonstrate code for both the cases and then you will be able to point out the exact difference between pass by value and pass by reference. Hey, by pass by reference we mean passing the value..which is infact the remote control(the reference!) :)

Saturday, June 21, 2008

Other than SCJP...what lies ahead?


This post will tell you about other Sun Java Certifications. Although many know only SCJP there are other plethora of Sun Java Certifications. Lets look at them, hey this knowledge isn't necessary for an SCJP taker to know but we should know where we are heading, right?

Sun Java Certification is itself a ladder and as you climb up the technology becomes more advanced and powerful. Many consider that SCJP is the 1st and most basic exam in the ladder but there is one more, its called SCJA - Sun Certified Java Associate Exam. These two are entry level exams in the ladder and you need to pass SCJP before you can give any of further examinations. There are core differences between the syllabus of SCJA and SCJP, like the "swing" is not included in SCJP but it is in SCJA. There is a difference between a java programmer and a java developer. You can call yourself a java developer after you give the special java developer exam called SCJD - the Sun Certified Java Developer exam. You are supposed to have the basic knowledge of java as a language after you complete SCJP and SCJD but you still dont know how to use the java language to the fullest i.e: developing web/standalone commercial products/applications from it - thats the path ahead. There are 4 certifications up the ladder each gives you a special knowledge about the corresponding technology.
They are...
1. SCWCD - the Sun Certified Web Component Developer exam.
2. SCBCD - the Sun Certified Business Component Developer exam.
3. SCDJWS - the Sun Certified Developer for Java Web Services exam.
4. SCMAD - the Sun Certified Mobile Application Developer exam.

The SCWCD portion is about the web components you need to build a web application. You should know how to develope a web application from scratch, before giving SCWCD. The SCBCD concentrates upon the business components required in an application, it includes in-depth study of the EJB (Enterprise Java Beans) technology. I donn't know about the SCDJWS. The next one SCMAD is concerned about knowledge about developing the java mobile applications. Hey the mobile in your pocket if it's java enabled (if it's cost is above 8k, mostly it is.) can run java applications developed by you! You may be thinking these certifications aren't that famous (so may be unimportant) but let me tell you that in the software industry, these special level certifications are valued the most. As SCJP is a pre-requisite for all these you need to pass SCJP before giving any of these. The ladder doesn't end here, there is one more certification at the top, and this is the highest one, it called SCEA - the Sun Certified Enterprise Architect exam. I really don't know what the portion is at this level and what knowledge we need to have... :)


I hope this post has helped you to know where we are and how far the journey is!

Saturday, June 14, 2008

My level of java knowledge right now...i.e.: before starting preparation...

Now after knowing Java from past 3 years my teachers will be ashamed if I say "I am pretty new to java." So I am not new to java, I know java from past 3 years and yes have done pretty good amount of coding in it. But knowing java and passing the Sun certification examinations are two different things. You don't need to have working knowledge of java to do programs and even projects in it, but the Sun certification examinations demand that you should not only know good ways of programming in java but also know bad ways of programming in java. A normal java programmer will write a code which runs fine, but a SCJP programmer is supposed to write the most efficient code - and that's where you should know the intracacies and details of the programming language. So, here I am, I am able to write java programs..sometimes very long ones, but nah nah.. I don't even know were they efficient or not.

Talking to the point, I have gone through most basic Java programming books like the Complete Reference by Herbert Schildt, some chapters of Core Java and even some chapters of SCJP preparation books by Kathy Seirra & Bert Bates. I havn't given even a single Mock Exam and havn't started preparation for the examinations as such. So, this is where I am beginning. Let's start now.... join me.

What this blog is about?

Hello friends,

Today I have decided to give the SCJP exam. You will find anything and everything related to SCJP over here. You will find the SCJP information, posts stating my journey of study..yeh you got it right...technical posts (and no philosophy..eek..!:) ) and in the process indirectly I will be sharing the knowledge with you all. This is a perfect place for people who are planning to give SCJP in near future or are preparing for it. The most interesting thing about this blog is that it will contain "my journey of facing SCJP" and that means I havn't yet given the exam and I will start preparing for SCJP. It's named "facing SCJP" because who knows I will pass or fail! :)

Warm Regards,
Saurabh