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

0 5679
dorukayhan
offline
dorukayhan
1,318 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 1-0 of 0