Saturday, September 27, 2008

Not to depend on the Dumps or Question Banks!!

Hello friends,

First my apologies for not being regular in posting exciting articles as before. I will be regular now onwards.

I am back with a piece of advice for you all. Please do not depend on the dumps/question bank or any other source which anyone provides you saying,"hey, just read these 200 questions and you will get most of the question from this only!" That sentence is partially true! But partially! You will never score high if you depend only on these question banks. Yes they claim that these are real questions from exams remembered from the people who have v the exams, and many other ways - I don't know. But it's the truth that these will only degrade you. Studying java passionately and then going and giving the exam needs guts, practice and will power to do it - lets what ever the result may be. And if you really study hard SCJP is really not that difficult! Keep this in mind!!

The number of questions repeated are very very low as compared to what the people selling these question sets say. And anyways knowledge lives forever, what if in the future you cleared SCJP with 90% and were not able to make a proper synchronized method, or unable to solve a simple NullPointerException! That will be so insulting for you! Clear the SCJP with knowledge and hard work, and it will definately pay you back!

Thursday, September 11, 2008

What are inner classes?


This topic is not for beginners or those at intermediate level. Not very difficult but may result in headache sometimes. So lets understand what are inner classes or nested classes - as some call them.


Inner class - as the name says are inside a class. Normal classes which we see are called outer classes because they are directly inside a file and not inside another class. Hey, if you are wondering whether a class can be inside a class?? Yes, it can be. But there are various complications in its use, and I suggest in real life not to use it unless they are unavoidable. But SCJP exam contains questions about such complex things..so its a very important concept. And hey its not boring, its very interesting topic... I will try to make it more interesting!

OK, let's see how a inner class looks like...

class A{
int a;

class B{
int b;

}//class B ends

}// class A ends

You can clearly see that B is inside A. When we create object of class A it doesn't mean we create object of inner class B also. We have to explicitly create object of inner class B. The inner classes can also be static! Yes, they can be. Also there can be more than one inner classes inside a class. You can create objects of them independently. Inner classes can have variables and methods as other classes... the members can be static, final etc.. The concept of Inner classes is not that simple, I thought to keep the first post easy, I will come with the difficult scenarios related to inner classes soon...

If you have any basic questions about inner classes, they do fire them in the comments section.. also try to code yourself, that is first thing to do when you don't understand anything.