0

Good Evening people,

I recently started working in Java (from Python).The issue occurs when I'm trying to split a string and then test some of its elements.

I checked many other answers to similar questions but nothing solved my issue.

String str = "0 0 0 0 0";
String[] splitString = str.split("\\s");

The System.out.println(splitString[0] == "0"); always outputs false !

However System.out.println(splitString[0].contains("0")); evaluates to true.

I fear that I'm doing something really stupid but I'd like to know if someone could help me here :)

Cheers,

Alex

Alex Koukoulas
  • 998
  • 1
  • 7
  • 21

0 Answers0