• Post Reply Bookmark Topic Watch Topic
  • New Topic

Confusion regarding Objects?  RSS feed

 
Rahza Nassah
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello!


Below is the example code :

If I enter a single uppercase letter for the first time, and then enter 1 to input again doesn't it overwrite the value of password? Once I enter any uppercase letter in the first input, it doesn't check the second input correctly. If I make another object then it does work fine, but in that case we have to create new object every time we take another input!

Output :
!!! contain characters while the check is for uppercase letters only.


Main class :
 
Paul Clapham
Sheriff
Posts: 22823
43
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, the problem is that uppercase_letter=0 happens at the wrong place in your code.
 
Rahza Nassah
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure where do I place it then to make it work for other inputs too.

Edited : NM, I got it I guess. But still waiting for you reply so that its more clear.
Edit 2 : Is it fine if I set the value to 0 again in the display function? Like :


Thanks!
 
Paul Clapham
Sheriff
Posts: 22823
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No. Just set it to zero before you start counting the upper-case characters.
 
Rahza Nassah
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
^ Thanks!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!