Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!

Christian Polychroniadis

+ Follow
since May 18, 2008
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Christian Polychroniadis

ThanKs EveryBody,

I just read the Katherine Sierra and Bert Bates, SCJP Guide, Its a great Book, My recomendations are:

- First, the book contains 10 Chapters and around 900 pages, you need to read at least 30 pages per day, if you do so continusly, you will be done in one month. But I think you will spend two months, don't extend it, two months is fair, could be less but if you spend more time, you will start to forget some details.

- Don't make the self test inmediatly after read the chapter, just continue with the next chapter, because you will spend time doing it and it woudn't be challenging, in the chapter 6, do the first 5 self test, now it would be better. Then Continue with the next 6 chapters and the others tests at the end.

- Now, start to make some mocks and any question that you think its interesting, bookmark it, answer and read the objective related to it.

- You need to score 75% or more in the mocks to be sure that you can pass the exam, no cheats, if you have done one exam many times, you need to do a new one.

- The Inquisition is a good test for Generics and Colections.

- Threads are the most dificult questions in the exam, and them would be at the end.

- The exam is 3 hours and 30 minutes aproximately, I know that you need to spend around 5 minutes per question, if you spend more time with one, just answer it, mark it, and continue. The Aplication Item questions couldnt be rewiew, if you do it, you erase your answer, so
just do it if you are sure and you have time, remember, this is only for drag and drop questions.

- You will be surprised, the chapter 10 about java, javac, and jar's is put on the exam, so do a lot of practice with packages and compilations.

- Go to the bathroom, eat, and drink an energy drink 15 minutes before the exam.

- Good luck, and I hope you will do it if you study and practice, remember, you need to try your theorys, don't use an IDE, use your notepad.

- Make notes with APIS content, FileWritter, NumberFormat, DateFormat,etc... Arrays and Collections utility classes.
- Also, make notes with All the Collections and Maps, uses and definitions.

Good luck and Thank you Everybody !!!
11 years ago

I just got my Certification today in Venezuela, I am so excited !!!. After three months of hard work !!. SCJP 1.6

You need to focus mainly on Collections and Generics, Threads and Development Chapters in K&B, Great Book !!!.

Remember to make a lot of programs and resolve at least four Mocks with 75% or above.

I also drank an energy drink before the test, I am not kidding it helps, you must drink one before yours too it helped me a lot !!!.

11 years ago

First you have to know that you can use compilation time constants in a case evaluation, now, I recomended to use a pencil and a piece of paper and write this:

Since x value is 2

case x:System.out.println("0"); case 2 print 0
case x-1:System.out.println("1");break; case 1 print 1 break;
default:System.out.println("def"); default def
case x-2:System.out.println("2"); case 0 print 2


So now is easier to match cases, remember, if you don't see the break, you fall throug the cases:

z=0, print 2
z=1, print 1
z=2, print 0 (no break) and print 1 (break).

So since z goes from 0 to 2 the output is (Your Case For loop from 0 to z<3):

2 1 0 1

if z would go from 0 to 3 the Output will be (For loop from 0 to z<=3)

2 1 0 1 def 2

Hello Henry, you are right, I changed the package name, it was just for testing purposes, but it worked, Thank you.

Now, if i make a .jar file with all the files, and I just have the jar file, how Can I compile the file, and How can I run it.

Supose that I put the jar file in the root dir, in this case is C:>, and I put all the folders, what Do I need to do ?

C:>jar -cf MyJar.jar java

and then

C:>javac MyJar.jar ?

and to run it ?

C:>java MyJar.jar AnimalTest ?

11 years ago

I am a little lost with the packages and JAR Files, I made a tree structure:


So, I compile, Without package sentence, and Everything is fine.

But when I specified a package for, the compiler could not find the others classes, even when they are in the same package, this is the code:

package java.myProyect.source;
import java.myProyect.*;

class AnimalTest{

public static void main(String args[]){
Animal a=new Animal();
Dog d=new Dog();;;
package java.myProyect.source;
public class Animal{
public void eat(){
System.out.println("Animal Comiendo");
package java.myProyect.source;
public class Dog extends Animal{
public void eat(){
System.out.println("Perro Comiendo");

And The other thing is that if I make a .JAR, Called, MyJar.jar, I can't even compile the, file I had tried, standing in the folder java:

c:>\java\javac -cp C:>java/MyJar.jar

And it did not work.

I apreciate any help, thanks.

11 years ago

I have read all the reply's, but for me this is the explanation:

The basic difference is that an interface is like a 100% abstract class, that means ALL of his methods are abstract, ALL. But an Abstract class can have, non Abstract methods too, so you have an specific behaviour, this is one's of the differences, think about it, you are getting a more specific behaviour with an abstract class.

The other difference is that in JAVA you can not extend more than one class, if you make an abstract class, you have to extend it, and you can not extend any other class, you loose that posibility. But is different with an interface, you can implement one or more interfaces, and have the posibility to extend any other class, so is more flexible, depends on what you need.

I hope this could help you, Bye.

Christian Polychroniadis soon SJCP...
11 years ago
OK, I'm going to explain, first you must change the array declaration to {1,2,3,4}, and that's what happen in the first for,

initial array, value, final array
iteration 1: {1,2,3,4} a[1]=0 {1,0,3,4}
iteration 2: {1,0,3,4} a[0]=0 {0,0,3,4}
iteration 3: {0,0,3,4} a[3]=0 {0,0,3,0}
iteration 4: {0,0,3,0} a[0]=0 {0,0,3,0}

The problem is the second for, if you see it, it do something like this:

print a[0] three times, and a[3] once, that's why you get 0 0 0 0.

If you want to print all the content of the array you need change it:

for(int i=0;i<arr.length;i++)

that's how you get 0 0 3 0

Now I think is clear.
Hi, Nabila Mohammad

Please change the array initialization, to {1,2,3,4} instead of {1,2,3,4,5}

if you included 5, you will get that error.