ForumsProgramming Forum(Not a question) Using strings in Java flow statements

0 762
dorukayhan
offline
dorukayhan
1,325 posts
Bard

String sampleText = "abcdefghijklmnopqrstuvwxyz"; while(sampleText == "abcdefghijklmnopqrstuvwxyz&quot{}

if u copy-paste this into a java ide and write some commands in the loop, u`ll notice that the commands arent getting executed despite the loop requirement is fulfilled. its because u should use a method called "equals" like this instead of a comparison operator:

String sampleText = "abcdefghijklmnopqrstuvwxyz"; while(sampleText.equals("abcdefghijklmnopqrstuvwxyz&quot){}

  • 0 Replies
Showing 46-45 of 0