• Post Reply Bookmark Topic Watch Topic
  • New Topic

method boolean  RSS feed

 
ekte spiriopoulos
Ranch Hand
Posts: 217
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i want to check a string if is true or not .To check it and to return true or false .That i should do a method .Where i should look at that any example of it?
 
Tim Cooke
Marshal
Posts: 3873
233
Clojure IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you mean by "string if is true or not"? When is a String true? When is a String false?
 
Liutauras Vilda
Marshal
Posts: 4665
320
BSD
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ekte, what I would suggest is, to slow down with creating excessive amount of threads, that means - create one, solve fully one exercise, move on towards another.
Messing around doesn't help for you, nor for everyone else. That process would look like:

1. Create thread
2. Get suggestions
3. Show us what you achieved
4. Get confirmation you got it right
5. Mark thread as "Solved" button at the bottom

6. Repeat 1.

Currently we are not even sure you absorb those suggestions and get some benefits out of it.
 
ekte spiriopoulos
Ranch Hand
Posts: 217
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Liutauras Vilda wrote:ekte, what I would suggest is, to slow down with creating excessive amount of threads, that means - create one, solve fully one exercise, move on towards another.
Messing around doesn't help for you, nor for everyone else. That process would look like:

1. Create thread
2. Get suggestions
3. Show us what you achieved
4. Get confirmation you got it right
5. Mark thread as "Solved" button at the bottom

6. Repeat 1.

Currently we are not even sure you absorb those suggestions and get some benefits out of it.
i will create after a thread that include all my questions together
 
Tim Cooke
Marshal
Posts: 3873
233
Clojure IntelliJ IDE Java
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ekte spiriopoulos wrote:i will create after a thread that include all my questions together

Please don't do that. It's encouraged that each thread contain a single question.

I think Liutauras is suggesting that you ask one question and then see it through to completion where you've solved your problem and then demonstrate how you solved it. Rather than firing out a bunch of disparate questions and then appearing to not follow up any of them to any sort of resolution.

So, back to the topic of this thread: What do you mean by "string if is true or not"? When is a String true? When is a String false?
 
Campbell Ritchie
Marshal
Posts: 55786
164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe you mean whether the text reads “true” or “false”. If that is what you meant, read on:-

All primitives have an associated class, with a name similar to the name of the primitive. These classes are often called wrapper classes. You can find all eight in the java.lang package. Each of those eight classes has a static method called parseXXX which can extract a value from a String. Go through the classes and you will find what you need, I think.
 
Junilu Lacar
Sheriff
Posts: 11166
160
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:Each of those eight classes has a static method called parseXXX which can extract a value from a String. Go through the classes and you will find what you need, I think.

In this case, the method to use will be valueOf() -- Edit: I see there's also a parseXXX. Either one will do.
 
Campbell Ritchie
Marshal
Posts: 55786
164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is a subtle difference between valueOf and parseXXX. The valueOf is a factory method which returns an object (in this case a Boolean) and the parseXXX method returns a primitive (boolean).
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!