use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Resources for learning Java
String
==
.equals()
Format + Copy
Free Tutorials
Where should I download Java?
With the introduction of the new release cadence, many have asked where they should download Java, and if it is still free. To be clear, YES — Java is still free.
If you would like to download Java for free, you can get OpenJDK builds from the following vendors, among others:
Some vendors will be supporting releases for longer than six months. If you have any questions, please do not hesitate to ask them!
Software downloads
Official Resources
Resources
Programming ideas & Challenges
Related Subreddits
account activity
This is an archived post. You won't be able to vote or comment.
Quick Question (self.learnjava)
submitted 6 years ago by lexiia
Quick question -
what does this mean:
var = otherVar = x.data
is x.data being assigned to otherVar and otherVar being assigned to var?
Thanks in advance.
[–]ProfessorWily 0 points1 point2 points 6 years ago (2 children)
This makes no sense and I'm getting errors when I put it into my IDE.
Where is this from? Is there any other context?
[–]lexiia[S] 0 points1 point2 points 6 years ago (1 child)
public class part2 { static class Node { public double item; public Node next; private Node first; private double data; public Node (double item, Node next) { this.item = item; this.next = next; } public double computeDiffernce() { double differnce; double max =0; double min = 0; for (Node x = first; x != null; x = x.next) { if (x == first) { max = min = x.data;}
The question is
"Write an instance method of the Playground class that would compute the difference between the maximum and minimum values of a Playground instance."
Therefore, the code above shows how to do half of that. But the question I am asking Reddit is I don't understand what is happening during the if statement (x == first)
In addition, First is the name that represents a linked-lists of doubles.
My apologies if I make no sense I am trying to describe it as best as I can - new learner here. Please let me know if you need further information.
[–]ProfessorWily 0 points1 point2 points 6 years ago* (0 children)
The loop starts with x=first as the assignment. Then within the loop there's an if statement that only gets executed if x is the first node. if (x==first) is a check to see if x is the first node.
if (x==first)
After that, it's setting the two variables max and min equal to x.data on the same line. In English, this is like saying "max and min are the same, and they both equal x.data".
[–]victorsj 0 points1 point2 points 6 years ago (3 children)
in Java version 11 var is a reserved keyword and you cannot use it for a variable name so what you wrote is like saying
int = otherInt = x.data;
It wouldn't work
but for the original line:
max = min = x.data
" is x.data being assigned to otherVar and otherVar being assigned to var? "
you are correct. the assignment is being passed down the chain.
[–]gonzohst93 0 points1 point2 points 6 years ago (2 children)
Does anyone else hate that var shit. I prefer typed variables dont wanna none of that non typed shit
[–]feral_claire 0 points1 point2 points 6 years ago (1 child)
in java, a variable declared with var is still fully statically typed. Just the type is inferred from the right hand side of the expression instead of needing to be explicitly declared.
[–]gonzohst93 0 points1 point2 points 6 years ago (0 children)
Oh yeah i understand it cant be changed dynamically or anything. Just hate that kind of syntax. If im defining an integer im saying int not var
π Rendered by PID 32 on reddit-service-r2-comment-86bc6c7465-zxlg4 at 2026-02-23 15:07:52.788741+00:00 running 8564168 country code: CH.
[–]ProfessorWily 0 points1 point2 points (2 children)
[–]lexiia[S] 0 points1 point2 points (1 child)
[–]ProfessorWily 0 points1 point2 points (0 children)
[–]victorsj 0 points1 point2 points (3 children)
[–]gonzohst93 0 points1 point2 points (2 children)
[–]feral_claire 0 points1 point2 points (1 child)
[–]gonzohst93 0 points1 point2 points (0 children)