[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology


Thread archived.
You cannot reply anymore.


[Advertise on 4chan]


File: WTFFFF.png (53 KB, 681x412)
53 KB PNG
JAVASISTAHS WHAT THE ACTUAL KEK IS THIS?!?!?!!!
>>
>programming LANGUAGE
>forced to use incomprehensible symbol/operator-babble instead of using actual language
C syntax is shit and designed purely to gatekeep.
>>
>>109612644
It makes sense.
>>
>>109612644
learn the difference between int and Integer, saar. although soon (tm) this will be solved by value classes.
still you should never use == for objects.
>>
>>109612695
>=
>Incomprehensible symbol
Burger or spiritually burger
>>
>>109612710
Yes a=b means equals. So how come if(a=b) is always true unless b is 0? Bug in the language.
>>
>>109612644
a and b are references. This is literally on the first page of the first chapter of Babby's First Java Tutorial.
>>
>>109612721
>Bug in the language.
Can't argue against that.
>>
>>109612735
no they're integers
>>
>>109612794
They're references to instances of the Integer class. They're references; a == b is compares pointers, not their underlying values.
>>
>>109612695
>>109612721
>>109612744
>a=b means equals
= is for assignment. == is for equality.
>if(a=b)
Not valid in Java. And a=b evaluates to b in C
There is no bug to be seen
>>
>>109612840
not they're not
>>
the absolute state of /g/: arguing about the basic semantics of a boomer programming language. You old people will all die alone and then finally this place will live again.
>>
>>109612846
>if(a=b)
This will not work, because a=b is an assignment statement, and assignment statements have no return value
>if((a = b))
This will in theory assign a to b, creating an expression that returns a. But the expression inside the if-statement must be of type boolean (or un-boxable to a boolean), there is no truthiness in java.

>>109612908
Taking the bait: because a and b are of type Integer, are definitely a reference. Integer is the wrapper type of primitive ints, with added syntactic sugar to allow for arithmetic operations to be done to them.

The Integer class is immutable and keeps a cache of Integer objects for int values 0 to 256 I believe, so Integer#valueOf does not need to instantiate a new object for common values. This is why a check for reference equality (==) is advised against when comparing the values an Integer object carries.

>>109612908
You truly are a nigger.
>>
File: 1757713427084012.jpg (46 KB, 600x400)
46 KB JPG
>>109612644
SAAR JAVA BEST!
YOU ARE LOW BRAIN IQ NO UNDASTAND JAVA HAHAHAHAHA
-1000 IZZAT
>>
>>109612644
First test would pass since all Integer objects between -127 and 128 are cached you filthy nigger faggot
>>
>>109612644
object a = 100;
object b = 100;

Console.WriteLine(a == b); // False


it's over for .NETsirs
>>
File: 1776838086885422.jpg (1.02 MB, 1577x2197)
1.02 MB JPG
>>109612644
For me I prefer this:
let a = 100;
let b = 100;

if (a.equals(b)) while true do {
console.writeln("try your best to stay alive");
}
>>
I'm a transgender woman by the way, if that matters
>>
File: 1787122053672860.jpg (41 KB, 733x733)
41 KB JPG
>>109613263
no matter how many times you put my name and calculated tripcode into the name field, it won't make you me. you would have to enter my name and my passcode into the name field, like username#password to be valid. however, i am definitely a transwoman regardless.
>>
this is why python is the best followed by typescript
>>
>>109612644
>JAVASISTAHS WHAT THE ACTUAL KEK IS THIS?!?!?!!!
most languages differentiate between value and reference types. one of the bigger mistakes of java was to expose those value types, sure it made the jvm more efficient but led to some pretty retarded shit down the line
>>
>>109612644
rustroon thread
>>
>>109613371
idk it just works on dotnet DOE
>>
>>109612644
Integer != int



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.