Posts Tagged ‘scjp’

SCJP – practice results

Thursday, July 14th, 2011

The results of my practice exams. Not included the mocks, questions that I did in several sites pointed by JavaRanch. From OCP Java SE 6 Programmer Practice Exams book (more SCJP resources) Assessment Test 1 – 71% Assessment Test 1 – 29% Exam 1 – 35% Exam 2 – 50% Exam 3 – 42% Exam [...]

SCJP – Java Enums

Wednesday, June 1st, 2011

enum CoffeeSize { BIG, HUGE, OVERWHELMING }; CoffeeSize cs = CoffeeSize.BIG; enum CoffeeSize { BIG, HUGE, OVERWHELMING }; // <–semicolon  is optional here   CoffeeSize.values()  // returns a Collection of CoffeeSize enums. A Collection, not an array   Syntax example of a enum usage public class WeatherTest { static Weather w; public static void main(String[] [...]

SCJP – New Java 6 features

Friday, May 20th, 2011

Main classes and methods Console Methods to access the console device Unique instance of this class java.io package System.console() Consoleformat(String fmt, Object… args) Consoleprintf(String format, Object… args) StringreadLine() returns a string containing the line read from the console StringreadLine(String fmt, Object… args) char[] readPassword() char[] readPassword(String fmt, Object… args) PrintWriterwriter() Scanner A simple text scanner which can parse primitive [...]

SCJP – Java I/O

Thursday, May 5th, 2011

Some diagrams and tables in this post from SCJP Sun Certified Programmer for Java 6 book.   File The API says that the class File is “An abstract representation of file and directory pathnames.” The File class isn’t used to actually read or write data; it’s used to work at a higher level, making new empty [...]

SCJP – Threads

Monday, February 28th, 2011

Dont forget wait, notify or notifyAll must have the this object lock. So look if they are in a syncrhonized method       To analyze synchronized method issues, don’t forget to verify if the threads are being created in same runnable object. If don’t the synchronized methods locks will be distinct. public void run() [...]

SCJP – Primitive types / Operators / Format

Thursday, February 24th, 2011

Java Primitive Data Types Type Values Default Size Range byte signed integers 0 8 bits -128 to 127 short signed integers 0 16 bits -32768 to 32767 int signed integers 0 32 bits -2147483648 to 2147483647 long signed integers 0 64 bits -9223372036854775808 to 9223372036854775807 float IEEE 754 floating point 0.0 32 bits +/-1.4E-45 to [...]

SCJP – Inner Classes

Tuesday, February 22nd, 2011

Content: Don’t forget Classes in the same file – NOT inners classes Inner classes (class inside a class) Instantiating an Inner Class Referencing the Outer Instance from Within the Inner Class Method Local Inner Classes (class inside a method) Anonymous inner classes Static Nested Classes Visibility Modifiers Don’t forget Inner classes cannot have static methods. [...]

SCJP – Language fundamentals

Wednesday, February 16th, 2011

Content: Don’t forget Notes Java Keywords JavaBeans Constructors Initializations, Static and init blocks Initiatization order Interfaces Finalize and GC Serialization Modifiers Exceptions List of Runtime Exceptions List of checked Exceptions Strings Override Overload Operators Static Polymorphism Switch If Else For loop Coupling, cohesion and encapsulation Encapsulation Coupling Cohesion Arrays Not related Instanceof Labels Assertions Java, [...]

SCJP – Regex

Monday, January 31st, 2011

left to the right the chars are consumed “\d” compile error    –> escape like this: “\\d”   –> This is a metachar “\.” compile error    —>escape like this: “\\.”   –> This is a dot, not a metachar 0[xX]([0-9a-fA-F])+    — The parentheses and “+” augment the previous find-the-hex expression by saying in effect: [...]

SCJP – Generics

Thursday, January 6th, 2011

Generics it’s a only compile time java feature. After the bytecode generation everything works as before. It’s not correct to use ? on the constructor invocation, the second part. We need to make an instance of a concrete type. new ArrayList<?>(); // doesn’t work because it must be instantiated with a concrete type new ArrayList<Set<?>>(); [...]