0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

javaの文字列比較

Last updated at Posted at 2016-06-24

javaで普通に

if(string==null){
}

でやったら比較されなかった(初心者)ので皆分かってると思いますけど一応解決策

if(string.equals(null)){
}

で比較されるっぽいです

////////////////////追記////////////////////

String型がnullだと上手く比較されない時があったので、そういう時は

if(string.length()==0){
}

で文字列その物の長さで比較すると上手くいきました。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?