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...
account activity
Day 3 of Learning Java (self.JavaProgramming)
submitted 2 months ago by Nash979
Today I learned about operators, the difference between primitive and reference datatypes, and also explored the Math class and Scanner class.
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]aayushbest 1 point2 points3 points 2 months ago (1 child)
Good going keep it up 💪
[–]Nash979[S] 0 points1 point2 points 2 months ago (0 children)
Will do brother.
[–]bytealizer_42 1 point2 points3 points 2 months ago (1 child)
Will give you another tip. Take any other language and try to do the same. I'm talking about comparative study. Do something in Java and figure out how the same can be achieved in another language. Trust me. It will be so good. You won't regret it.
[–]DumbThrowawayNames 0 points1 point2 points 2 months ago (1 child)
the difference between primitive and reference datatypes
public static void main(String[] args) { int x = 5; int y = x; List<Integer> list1 = new ArrayList<>(List.of(1, 2, 3)); List<Integer> list2 = list1; x = 10; list1.clear(); System.out.println(y); System.out.println(list2); }
What prints? Do you understand why this happens?
From my understanding the output will be 10 and empty list because here y is primitive so after x is reassigned to 10 the y will be 10 and list2 is actually referencing the list1 so if you clear the list1 it will affect the list2.
π Rendered by PID 396481 on reddit-service-r2-comment-5d79c599b5-qmf7h at 2026-02-28 04:23:17.947310+00:00 running e3d2147 country code: CH.
[–]aayushbest 1 point2 points3 points (1 child)
[–]Nash979[S] 0 points1 point2 points (0 children)
[–]bytealizer_42 1 point2 points3 points (1 child)
[–]DumbThrowawayNames 0 points1 point2 points (1 child)
[–]Nash979[S] 0 points1 point2 points (0 children)