Condition is wrong pliz help | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Condition is wrong pliz help

eg class A{ } class B{ public static void main(){ int a; A aa = new A() ; If (a == aa){ } } }

18th Dec 2017, 3:19 PM
Core i9
Core i9 - avatar
2 Answers
+ 5
Yep, different datatypes don't match
18th Dec 2017, 3:26 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 3
a is an primitve type integer, while aa is of type A. integer =/= A you'll always get false.
18th Dec 2017, 3:25 PM
Jeremy
Jeremy - avatar