Alejandro Galv�n

Greenhorn
+ Follow
since Nov 17, 2007
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Alejandro Galv�n

Hello ranchers! Could you recommend me a good book to study in order to achieve the SCDJWS?

Thanks,
Hi Milton:

When you take the exam you must be agree with the confidentiality agreement, so I can�t tell you how the exam is. I think I just can tell you the questions in the exam are like in mocks, you must really think and know what the given code does and don�t. Some mock exams are simple, so if you take mock exams, ensure you have a good knowledge of logic and java behaviors. Take care of the goals of the exam in order to know what topics you�ll be evaluated. As the good K&B said: some questions seems like are evaluating you something but maybe are evaluating you something else.

Hope this help you. Good luck.

Alejandro
13 years ago
Hi Ranchers:

I�m developing and app and deploying in jboss 4.0.3, I changed some files and I�m getting a DeploymentException cause struts.jar is looking for commons-collections.jar, my question is if this exception can crash down my jboss AS. I ask because since I deployed this changes I get the exception and jboss crash down but it looks like running, the only thing I noted is it seems as loosing memory.

Thanks in advance,

Alejandro
13 years ago
Hi Rajasekhar:

First: are you sure this code compiles, because it will give you at least 7 compiler errors.

This will be the correct code:



Well, once fixed, the wizlab�s answer is correct, it�s all about polymorphism. Take a look in the main method, you are creating a SuperBase object with a reference variable a1 of type SuperBase, there would not be any problem with that, but also you are creating a Base object with the reference variable b1 of type SuperBase too (here is the first polymorphic thing), and finally you are creating a Derived object with a reference variable c1 of type Base (here is the second polymorphic thing).

Then you are calling the print method inside the a1 variable, here there would not be problem, then you are calling the print method inside the b1 variable, but here remember that b1 is of type SuperBase, so b1 just know its own print method, the one inside of SuperBase (if you want the print method of Base class you must down-cast b1) and you are passing it a Derived object, but remember that Derived is grandchild of SuperBase, so a Derived object IS-A SuperBase object too. Finally you are calling the print method inside the c1 variable, remember c1 is of type Base, so c1 just know its own print method which takes a Base object as parameter and the one inherited from SuperBase, and (again) you are passing a Derived object and remember that a Derived object is a child of Base, so a Derived object IS-A Base too. Then the JVM decides that it will use the print method which takes a Base object.

Do you get it?

I hope this help you to understand it.

Regards,
Hi Maya:


It�s easy. Your exception is thrown because you have declared a classC reference variable which doesn�t point to any object of type ClassC. So, you are calling a method which can�t be accessed, remember you doesn�t have an object that can call the method, you only have a reference variable, but to do this

public ClassC classC;

doesn�t create an object.

Look at ClassA, you are instantiating an object in ClassB classB=new ClassB();, try to do the same in ClassB, write
ClassC classC=new ClassC();, it must compile and run fine.

Regards,
Hi:

Ian:
Be careful, method2() is inherited by Test class, it�s not the reason.

Armel:
Maybe I wrote wrong, the output given by your JVM is correct, not the one you think.

Thanks,
Hi Armel:

Your output is well. You have declared your reference variable p as type Parent, but Test. That means that your reference variable only knows the Parent�s behaviors, if you want the Test�s behavior (means methods) you must down-cast it or declare your reference p as Test type. Read about polymorphism.

Do you get it?

Regards,
Hi Karen:

First, sorry about the long time. I had been working very hard and I didn�t have time to login here, but I�m back, I studied with other book, and the problem might be wrong writed, because the same question have a difference in the operators, it gave:
-=
=
*=
*=

and the answer is:

x *= X;
Y *= Y;
Y = Y;
x -= Y;

it gives the expected output

Hope this still help you
Try to use the ONE OR MORE modifier ('+'), and you will see the out put: 234, which means in position 2 are the digits '34'
Hello Pav:

You are passing "\d*" as pattern, remember that the '*' modifier means ZERO OR MORE, so your program is asking for any place in which it found ZERO OR MORE DIGITS, that�s why the output show you all positions. The out put means:
"there are 0 digits in position 0,
there are 0 digits in position 1,
the digits '34' are in position 2,
there are 0 digits in position 4,
there are 0 digits in position 5,
there are 0 digits in position 6"
Remember that this Regex methods return the initial position and the matches.

Regards,
Hi Alexsandra:

Maybe I�m wrong cause the statics blocks run when the class is first loaded, but I think the output is given about the instance of the class, I mean, since you are just calling a variable of the Cat class and you have no instance of the Cat class, it just need to call to the superclass constructor, so, before the Animal constructor is loaded, the static method runs, and you have "animal static", but the x variable already exists, so you don�t need to load the Cat class. In the second case you have the x variable in the Cat class, so you must load the class in order to have this variable existing and then the static "cat static" method runs. If you make an instance of the Cat class before printing, you will have both outputs, because you load both classes.

I repeat, maybe I�m wrong, but I modified your code in other ways and the outputs let me think it is the answer.If someone else have a different answer, please explain.

Thanks,

Alejandro
Hi:

Yes, you�re right Srinadh, I was wrong in that, but, as I said and henry confirmed, in this case you have two distincts reference variables to the same array, I also said that the access modifier "private" just work in the private "name" on Person class, but in Demo class. Remember that arrays are objects, they don�t behave in the same way as primitives. Also, as Henry confirmed, if we try the same with a primitive variable, it works as expected.

Thanks,

Alejandro
Hi Deepesh:

I'm agree with Jesper, in addition, is this the first problem you have of this kind ("Can not find java.lang. ...), are you sure your path variable is well-configured? check it
Hi Karen:

I think in the same way, when I saw that question in the book i said, "this output is really possible? What i'm supposed to be a SCJP or a Mathematic?" Have you the answer?