Mauricio Lopes

+ Follow
since Aug 04, 2009
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 Mauricio Lopes

When Tomcat loads the web.xml file? Only when the first request is made?
What is the container lifecycle, since its start?
11 years ago
Thanks Stephan!

I've not mentioned that the code was as you told to be a Collection<Node<T>>. But on design progress I needed a subclass of Node<T> called HeuristicNode<T>. Somewhere else I've gonna need to add that subclass object to fringe. That's why the fringe must be as it is declared.

Can imagine any other solution!?
11 years ago
On my way studing AI, I've trying to develop an heuristic search and I come up with the following problem:

I have a fringe in a superclass:

for each different search strategies I have a subclass that instantiate a different kind of fringe, for example:

the add() has a compilation problem:

The method add(capture#2-of ? extends Node<T>) in the type Collection<capture#2-of ? extends Node<T>> is not applicable for the
arguments (Node<T>)

What's happening?
11 years ago
That's amazing ! What a great help !

Oh yeah, it's written in capital letters "MÉTODOS STATIC NÃO PODEM SER SOBRECARREGADOS." (static methods cannot be overloaded). I've got a portuguese version of that book, perhaps it's mistranslated. It says that it can be hidden by another implementation, as you explained.

Thanks a lot !
Reading S&B for Java 5, in the end of chapter 2 there is the following statement:

"static methods cannot be overloaded".

But testing it on my IDE i've written the following valid code:

That's an overloading or am I wrong ?

I got the S&B book for SCJP 5 and i want to know if it is recommended to buy the SCJP 6 version to proceed to SCJP 6 exam certification test?

It's seems to me that it has not got such a difference between those books, as the exam objectives has not changed so much.

What is your suggestion about it ? Can I learn those others objectives only having links and tutorials for this exam version ?

Henry you got my question.

Thanks for the effort to solve my doubt. I think it got my mind relaxed.

I know how and when to use overloading and overwritting, but the point is:

Why overloading methods call is solved on compilation time, and overriden is solved during execution ?

Saying that overloading is different from overwritting does not answers the question!
On my way studying for SCJP i've found something slightly strange about method's overloading. Why it works diferent from overwritting? Take a look below:

Somewhere else you may instance:

the result is // print A. The method choice is solved on compilation time.

But overwritting works different like below:

Somewhere else:

The method choice is made on execution time. // print b

Why such a difference between overloading and overwritting ???
Its not so difficult to find J2SE books saying that a subclasses 'earns' visible methods from an inherited superclass.

On my way studying for SCJP i found this terminology a bit diferent from what the concept of method inheritance
appears to be.
I think the right way to talk about inheritance is to say that a subclass just can make use of visible super methods, either
for subscribing or for using method's code.

Is it right to say that stuff ??
I've been trying to make an image rotate in a panel. I did it. But also i want the image to make a translation.

Here is the code i tryed at paintComponent() :


Graphics2D g2 = (Graphics2D) g ;
AffineTransform at = new AffineTransform() ;

// at.rotate ( angle in radians ) ;
at.rotate( this.getAngulo(1, 1) ) ;

g2.drawImage(imgemFlecha, at, this);


I cant change image x,y doing this drawImage(). I want to make that change.

Any suggestions ?
12 years ago