By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,484 Members | 1,031 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,484 IT Pros & Developers. It's quick & easy.

Need help with the basics..from a newbie

P: 3
Hi,
I'm real new to Java and need some help...was going through some old tutorials and need help with these questions:
1)What is “composition of methods?” How do u define the composition of methods?

2)What is the difference between the output from
String s;
System.out.println(“s = “+s);
and
String s = new String();
System.out.println(“s = “+s);

The value in string in the first code will retain its original value while the 2nd would get its string s value from the "new string" variable. Is this right?

3)What is the difference between equality of objects and equality of the references that refer to them?

4)What are the two parts required of every recursive method?
The counter(is this correct?)...and??

5)What does int[8] represent?
int refers to the data type of 8,being an integer and 8 being the value passed down(parameter). Is this correct?

6)What’s wrong with this:
char[] name=”Boris Yeltsin”;
Boris Yeltsin should be declared as a string type..without the " ". Is this right? Should the [] be there? There are no arguments being passed down.

Would appreciate your time.
Thanks

-Newbie
Mar 10 '07 #1
Share this Question
Share on Google+
3 Replies


10K+
P: 13,264
Hi,
I'm real new to Java and need some help...was going through some old tutorials and need help with these questions:
1)What is “composition of methods?” How do u define the composition of methods?

2)What is the difference between the output from
String s;
System.out.println(“s = “+s);
and
String s = new String();
System.out.println(“s = “+s);

The value in string in the first code will retain its original value while the 2nd would get its string s value from the "new string" variable. Is this right?

3)What is the difference between equality of objects and equality of the references that refer to them?

4)What are the two parts required of every recursive method?
The counter(is this correct?)...and??

5)What does int[8] represent?
int refers to the data type of 8,being an integer and 8 being the value passed down(parameter). Is this correct?

6)What’s wrong with this:
char[] name=”Boris Yeltsin”;
Boris Yeltsin should be declared as a string type..without the " ". Is this right? Should the [] be there? There are no arguments being passed down.

Would appreciate your time.
Thanks

-Newbie
Post also what you think are the solutions to these questions.

You can also read here for some ideas. We can only give you solutions when you have tried on your own and are convinced you cannot get them correct.
Mar 10 '07 #2

P: 3
Post also what you think are the solutions to these questions.

You can also read here for some ideas. We can only give you solutions when you have tried on your own and are convinced you cannot get them correct.
Hi there,
I have written the solutions there...or what I think. I need someone to correct me as I myself am not sure if I am correct or not and need some guidance.
However..I really don't have a clue abt a couple questions....
Mar 10 '07 #3

10K+
P: 13,264
Hi there,
I have written the solutions there...or what I think. I need someone to correct me as I myself am not sure if I am correct or not and need some guidance.
However..I really don't have a clue abt a couple questions....
Ok. Where did you get number 1? It doesn't sound right

Composition specifies a “has-a” relationship between classes(not methods) where one class has a data member that is an instance of the other class, such as “a car has a tire”. When creating a program, you need to choose whether to relate classes through inheritance or composition.

Here is an article about it.
Mar 10 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.