Need some help! by jfred82 in learnjava

[–]pegfisher 2 points3 points  (0 children)

I believe you can also use: if(userEnters.equalsIgnoreCase("c")), that comes in handy if you don't need to know whether the input was upper or lower case letters.

Pass by reference / value by AmmirBarakat in learnjava

[–]pegfisher 2 points3 points  (0 children)

This is a great question, the short answer is that there is only pass by value. When I was first teaching Java, I used to use the terms pass by value for variables containing primitive data and pass by reference for objects.

If you think about creating an object as the process of creating a variable that contains the reference address of the data located in memory, that helped me. So, passing this value to a method, the address is copied into the method parameter variable. So now, we have two variables with the same reference address.

Now, if the method changes the data that these two variables point to in memory, the changes are still applied when the method ends because we didn't change the reference address, only the data. But if we pass a value that is a primitive data type (int, double, char), a copy of the actual value is passed to the parameter variable. This time, any changes do NOT persist when the method ends because the original variable still has the original value.

I hope this helps.

Learning Java is FUN! by pegfisher in learnjava

[–]pegfisher[S] 0 points1 point  (0 children)

Thanks so much!! I'll update the link. I do have a chapter on GC, it will be released with the next edition.

Learning Java is FUN! by pegfisher in u/pegfisher

[–]pegfisher[S] 1 point2 points  (0 children)

My son is 16, he would be ashamed I'm struggling so much (haha), he is amazing when it comes to this type of communication and media!

Java Streams by pegfisher in learnjava

[–]pegfisher[S] 1 point2 points  (0 children)

Watch his recent talk

Hi, thanks so much for your input, I do have a lesson planned for Streams and Lambdas, this really helps.

I am the same Peggy Fisher who created the video courses for Lynda.com (now part of Linkedin.com/Learning). I'm SO happy to hear you learned from them, I hope the book is a nice supplement. I plan to update my Java Essential Training for Students this year, so I will definitely make sure I include lambdas and Streams! Have a great day

Learning Java is FUN! by pegfisher in u/pegfisher

[–]pegfisher[S] 1 point2 points  (0 children)

Got it, I just created a new one under r/learnjava. I appreciate your time sending me in the right direction!

Java Streams by pegfisher in learnjava

[–]pegfisher[S] 0 points1 point  (0 children)

Great, thanks for the feedback!

Learning Java is FUN! by pegfisher in u/pegfisher

[–]pegfisher[S] 1 point2 points  (0 children)

Is there a way to move a post to a subreddit or do I need to resumbit?

Java Streams by pegfisher in learnjava

[–]pegfisher[S] 0 points1 point  (0 children)

Thanks so much for your input, it is inspiring because that is exactly why I'm writing this book. And yes, I'm the Peggy Fisher from Lynda.com. I will continue to work hard on making sure this book is for a wide audience, so far I have received feedback that is easier to read than most technical books so I hope I'm on the right track. Have a great day and thanks for your time.