In general, I learned Python, you can just write in it

if *допустим просто строка*: *Что произойдет если строка не пустая* 

For example:

 a = 'Hellow world!' if a: print('Строка вернула True') 

So here. And in Java (so I call Java) so nilz, gives a compilation error.

What method can be used in Java so that the method returns true if the string / array is not empty, otherwise false ?

Also what are the methods in Java like str() / int() for translating to string / number in Python?

  • You can read about String in Java here - not a Programmer

1 answer 1

What method can be used in Java so that the method returns true if the string is empty

 str.isEmpty(); 

array is not empty

 int[] a = {}; if (a.length == 0) 

Also what are the methods in Java like str () / int () for translating to string \ number?

 int val = 123; String str String.valueOf(val); val = Integer.valueOf(str); str = Integer.toString(val); val = Integer.parseInt(str);