The Artima Developer Community
Sponsored Link

Java Answers Forum
Please Help!

25 replies on 2 pages. Most recent reply: Sep 23, 2003 3:27 AM by Senthoorkumaran Punniamoorthy

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 25 replies on 2 pages [ « | 1 2 ]
Senthoorkumaran Punniamoorthy

Posts: 335
Nickname: senthoor
Registered: Mar, 2002

Re: Please Help! Posted: Sep 22, 2003 4:18 AM
Reply to this message Reply
Advertisement
So isn't thats what exactly David has said in his post?

int x = getHeight(k2.left);

the compiler assumes that you're referring to the current object. It is as if you wrote:

int x = this.getHeight(k2.left);

boils down to

The code

int x = getHeight(k2.left);

is same as if you wrote

int x = this.getHeight(k2.left);

:-)

mausam

Posts: 243
Nickname: mausam
Registered: Sep, 2003

Re: Please Help! Posted: Sep 22, 2003 4:26 AM
Reply to this message Reply
Where is my coffeee......Grrrrr

Thanks yaar i was confused.....

Vincent O'Sullivan

Posts: 724
Nickname: vincent
Registered: Nov, 2002

Re: Please Help! Posted: Sep 22, 2003 5:16 AM
Reply to this message Reply
There should be no difference (because the default instance of the method called is the one that comes with the current instance of the class (i.e. this one).

V.

Vincent O'Sullivan

Posts: 724
Nickname: vincent
Registered: Nov, 2002

Re: Please Help! Posted: Sep 22, 2003 6:28 AM
Reply to this message Reply
> err....I have to pick up a point here Vincent...The
> following code WON'T work:
> public class Dog
> {
> ...
> }

You're quite right, of course. Which just goes to show two things:
1) Just because you've "known" something for years, doesn't make it true.
2) Never publish even the simplest code without testing it first.
3) Name shadowing is evil.
4) Don't count your conclusions before you've made them.

Vince.

Kenny

Posts: 5
Nickname: ck890
Registered: Sep, 2003

Re: Please Help! Posted: Sep 22, 2003 8:03 PM
Reply to this message Reply
Thank for the help again!
I have another problem now.
How do I use sort?

sort
public static void sort(Object[] a, int fromIndex, int toIndex, Comparator c)

what is comparator?
I write
String[] array = { "abc", "def" )
sort(array, 0, 44);
which will not work!
How do I use it? Thanks!

Kenny

Posts: 5
Nickname: ck890
Registered: Sep, 2003

Re: Please Help! Posted: Sep 22, 2003 8:18 PM
Reply to this message Reply
My purpose is to sort a string array in alphabetical order.
Can sort method do it?
if not, how can I do it?
Thanks!

Senthoorkumaran Punniamoorthy

Posts: 335
Nickname: senthoor
Registered: Mar, 2002

Re: Please Help! Posted: Sep 22, 2003 8:31 PM
Reply to this message Reply
Read this

http://www.javaworld.com/javaworld/jw-12-2002/jw-1227-sort_p.html

Kenny

Posts: 5
Nickname: ck890
Registered: Sep, 2003

Re: Please Help! Posted: Sep 23, 2003 12:36 AM
Reply to this message Reply
Thanks again!
One last question!
how to change string into int?

example
string s = "12";
int x;

how to make x to store the integer 12 with string s?

Thank You!

Senthoorkumaran Punniamoorthy

Posts: 335
Nickname: senthoor
Registered: Mar, 2002

Re: Please Help! Posted: Sep 23, 2003 2:11 AM
Reply to this message Reply
Integer.parseInt(s);

Vincent O'Sullivan

Posts: 724
Nickname: vincent
Registered: Nov, 2002

Primative Type Conversion Posted: Sep 23, 2003 2:18 AM
Reply to this message Reply
For a utility that suggests/generates sample code for converting Java primative types, check out theConversion Amenuensis at http://mindprod.com/amanuenses.html.

Vince.

Senthoorkumaran Punniamoorthy

Posts: 335
Nickname: senthoor
Registered: Mar, 2002

Re: Primative Type Conversion Posted: Sep 23, 2003 3:27 AM
Reply to this message Reply
Vince,

Thats a pretty good link. Thank you.

Senthoor

Flat View: This topic has 25 replies on 2 pages [ « | 1  2 ]
Topic: Sample Code Required Using jPOS libraries Previous Topic   Next Topic Topic: URL Rewriting?

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use