Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Is it possible to write code like this in JAVA?

I am learning java. Is it possible to write code like this? what could be the possible value of <> to satisfy the condition ?

public class Test{
  public static void main(String [] arg){
    Integer i=(<>);
    String s=(<>);
    assert (Object)s== (Object)i;
  }
}

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

There is only value that can be both an Integer and a String (technically it’s its own type).

Integer i = null;
String s = null;
assert (Object)s == (Object)i;
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading