Win a copy of Head First Android this week in the Android forum!

Jake Miller

Ranch Hand
+ Follow
since Jun 27, 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 Jake Miller

No one else wants to join?
Have we decided on a way of communication *coughAIMcough*?
AIM: JakeMiller13
I currently do not go on that much, but if this is the way people want to communicate I will go on regularly.
I do have Windows, but as marc implied maybe others do not. Maybe a different service? I already have AIM, but it seems maybe MSN Messenger might be more universal...?
This is exactly what I need. I am ~100 pages into the head first book and am completely lost. As another poster said, my schedule is going to be hectic going into the semester, but I'll do my best. Let me know about which programs exactly you want to use for communication for this because I don't have any of the ones mentioned.

Age: 20
Location: Vassar College (Physics and Astronomy Major)
Background: Some HTML, bits of very random languages, not much else
Goals: To write Physics/Astronomy related applications

Originally posted by marc weber:

In the method maybeNew, "index" is the int value that's passed to the method as a parameter. So when we call the method with maybeNew(x), then "index" is assigned the value of x.

This method is defined as "public int maybeNew(int index)," so it must return an int value.



Ok, I get the first part of your post, but I'm still confused about this then:


I am supposed to insert index < whatever. You say it must return an int value, but where/what is this int value?

Thanks again.
14 years ago
I know that [] is often used to form an array, but what else is it used for? I am in general confused about () vs [] vs {}. Why do a lot of commands end with () with nothing in the parenthesis?
14 years ago
Thanks again Marc. I am starting to understand it...slowly. I am still a little confused with the

Mix4 [] m4a = new Mix4[20];

The name of the class I am creating is Mix4, right? So when I create a new Mix4 array, the elements of the array are (ultimately, after putting them in) references to other Mix4s. This seems to me like a neverending cycle: create class Mix4, method create an array of Mix4s, each Mix4 is a class with the method to create new Mix4s in it... Am I misunderstanding this?

I am also confused about the maybeNew method and how the adds in to this whole thing, specifically the
index < 5
part. We declare index to be an int value, right? But we don't set it equal to anything to start with, so how can the program know if it's less than 5, 7 or 1. And then the return 1/0 part, this is returning an int value or 1/0, right? Can it return any other values, such as strings?
14 years ago
Sorry to bombard this message board with simple questions, but I am teaching myself this and it's really not going too well. I wasn't sure the best subject line for this question either.

There is an exercise at the end of one of the chapters in this book where it presents most of a code with just 2 parts taken out. You are supposed to put in certain pieces of the code into their respective parts and predict the output. I am having a lot of trouble with this both understanding line by line what is going on, and overall.

Here is the code, as well as what I understand each line is doing. The "//insert ..." are the different pieces the code gives, with the first piece of the first line going with the first piece from the second line. Anything in bold is my comments about the code.



Hopefully this all shows up how I want it to. If not, or it's not clear in any way, please don't hesitate to ask. I appreciate any responses at all since I know this is kind of an involved question. Thanks.
14 years ago
Ernest-
Thanks a lot. So I guess I did understand it (minimally), it's just that that line doesn't really do a whole lot which was confusing me. Your examples are helpful, but a quick follow up. I'm just a little confused about this one:


Now, how do we make this useful? Imagine a Report class, with setTitle(), setNumColumns(), setData(), setLogo()... then you build a Report, and then call Report.preview(). It if looks good, you call report.print().


How does that relate to objects remembering their states?
14 years ago
Here is the code:


It's entirely possible I don't understand the setTime method with the void (this just means that it performs the method without spitting out a value, right?), but I am confused about why they do "time = t." They have already established time as a string, and then they copy it to "t" but don't seem to do much with it. What's going on?
14 years ago

Originally posted by marc weber:

But if you want y to change whenever x changes, then maybe you don't need y at all. Just use x.




Oh yea. You could do that huh
14 years ago
Thanks, pretty helpful. Another question re:

"In line 1, a cup called x, of size int, is created and given the value 3.

In line 2, a cup called y, of size int, is created and given the value... 3.

The x variable is not affected!

Java COPIES the value of x (which is 3) and puts that COPY into y. "

So in Java, if I type int x = 3, int y = x, it COPIES whatever x is and puts it into y. It's as if I right clicked on x and pasted it to y, right? How would I have y reference x, as in if I changed x it would also change y? (Like in excel when you reference another cell and change that cell...)
14 years ago
Ok cool, I think I get it. So a method call is really just "calling a method" ie performing a method.

Quick aside, how do you put tabs in a message? Tabbing for me just goes to Add Reply, etc.
14 years ago
What does it mean that Java is pass by value?
14 years ago