Peter Granstrom

Greenhorn
+ Follow
since Jun 08, 2009
Merit badge: grant badges
For More
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 Peter Granstrom

hi im a little bit confused about when to use the equals method. on page 544
it says if you need to know if the objects themselves are equal use the equals
method. but then on page 545 it says the equals method in class Object uses only the
== operator for comparisons unless you override equals.
so do i use it to compare objects but first after i override it, seems so much work
if i only want to compare objects
ok i think i found what i need a for loop and some good thinking,
14 years ago
i havent given this enough thinking .. sorry for that.. i will post when i tried
a little bit more ..
14 years ago
Hi,
i want to make a while loop for 4 letters i have given
some random values in, does anyone know anyway i
can do that?
14 years ago
thank you for your answer,
it helped me
14 years ago

Narendira Sarma wrote:

Peter Granstrom wrote:
Hi i liked your answer,
but i think in the if() i would try to decide if boolean to true or false before
because then you dont have to make changes afterwards and can decide
before if its right or wrong and probably get a better structure in your code



Hi Peter,

I couldn't understand what you were trying to say. I am a rookie programmer myself. That being said, I showed him how "I" would have handled the situation.

But I am eager to learn. Could you please tell me more clearly?

Thanks
-Naren



maybe if able to decide boolean to true or false before the if ()
then you might be able to use a more flexible code .. im not sure thou
14 years ago

Narendira Sarma wrote:In your code posted above, you are displaying the Error message after each combination is checked from the text file.

Instead of showing the Error message in the else part, you can have a boolean variable assigned to false. If a match is found assign the boolean as true.

After the while loop finishes, check for the boolean and if it is false, display the Error message. This way you will display the error message only once.

Hope I am clear. I will write something like below.




Hi i liked your answer,
but i think in the if() i would try to decide if boolean to true or false before
because then you dont have to make changes afterwards and can decide
before if its right or wrong and probably get a better structure in your code
14 years ago
I think i read somewhere that all classes is related
to Class object so if you make an abstract class,.
it should be related to object only further up the
inheritance three..
but im not sure if this answer is everythin correct,
so i suggest you read further on this subject
14 years ago
To me object.hierarchy is what it sounds like, its the
hierarchy of Object, which mean everything that is
inherited from Object.. kinda like the description above..
if someone interfaces take part in the object hierarchy i would
say ye but only if its something you write that it should,. its not
something that is automatically inherited

14 years ago