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 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

[[pageindex]] Don’t forget Inner classes cannot have static methods. Exception is static inner classes. Classes in the same file – NOT inners classes not inner classes there can only be one public class per .java file, as public classes must have the same name as the source file.     Inner classes (class inside a […]

SCJP – Language fundamentals

Wednesday, February 16th, 2011

[[pageindex]] Don’t forget to look to call to a non-static context from a static context. E.g. call from main to a non-static method. Or to refer from any static method to this. to check the initialization of local variables that are used for reading. In particular in main method. to check if variable are initialized, […]

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<?>>(); […]