If you're planning on sitting an #OCP exam, I highly recommend the study guide by @ScottSelikoff and @jeanneboyarsky.
Once you're done with the book, I suggest you take practice exams @Enthuware. And I can't stress this enough.
The exam is hard! And mainly because:
- The topic list is very long (there is a lot to learn).
- The time to answer a question is very short (less than 2 mins per question).
- The examiners try to trick you.
So you really have to be on your game.
But this is not meant to scare anyone away.
If you prepare well and study well, you'll be fine.
And plus, I'm here.
Hit me up with a question if you get stuck.
Preparing for Java Developer interview?
our book Grokking the Java Interview can help, it covers
- oop
- multithreading
- collections
- design patterns
- gc
download the sample PDF for FREE - javinpaul.gumroad.com/l/HMOA…#Java#Programming
static vs instance (non static)
If we had a class:
public class JavaTutor {
public int followers = 0;
}
And we created 3 objects of that class:
JavaTutor jt1 = new JavaTutor();
JavaTutor jt2 = new JavaTutor();
JavaTutor jt3 = new JavaTutor();
But if followers was static:
public class JavaTutor {
public static int followers = 0;
}
And we did the same thing as before by changing followers in jt1 from 0 to 1.
Now, followers in tj2 and tj3 are also 1.
So by setting our field to static, all objects of JavaTutor now share the same copy of followers.
Changing the field in one object is reflected in all objects of JavaTutor.
To print in Java we use:
System.out.println()
Let’s break it down:
1. System is a class.
2. Within that class is the static field - out, of type PrintStream.
3. Within the PrintStream class is the method println().