Java Java Objects Meet Objects Welcome Back

John Loön
John Loön
477 Points

String.loweredWords

Hi! When Craig is gonna show the "String.loweredWords = someWords.toLowerCase", at 5.05 I don't get what he's doing. He just makes the rest of the text appear and quickly says something about ”When there is multiple options there so it’s gonna show us”. I don't understand how the rest of the code appears!

3 Answers

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 84,571 Points

Craig is using the terminal in Workspaces to demonstrate some methods you can use on Strings.

he's doing this in jShell which is a kind of command line interface you can use with Java.

When you type commands in what you're seeing is feedback, a response by the commandline to what you have typed in.

For example it tells you if a method or expression evaluates to true or false. Have a go at the jshell like Craig does and you'll get a handle on the kind of troubleshooting you can do. :)

John Loön
John Loön
477 Points

Hi and thanks for a quick answer! Yes I think I understand the thing as a whole (kind of). The specific problem is at the moment I mentioned when Craig is writing "String loweredWords = someWords.to...." and then after "to", where I made the dots, I’m guessing he tabs or something and this appears:"LowerCase(toLowerCase(" so the whole thing looks exactly like this:

"jshell> String loweredWords = someWords.toLowerCase( toLowerCase("

After that I guess he press Enter and jshell repeats this:

”jshell>String loweredWords = someWords.toLowerCase(”

How do I get this to appear?

I’m sorry if I’m explaining it bad but I’m really stuck and I just can’t seem to grasp how to follow in workspace!

BR John

Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 84,571 Points

I'm not sure what system you're using to follow along, whether it's Workspaces, Terminal or Bash. I'm not sure how to replicate the behaviour he's using as I'm not sure what he's doing.

But it looks like he might be looking to see if the toLowerCase() method provides options that can be passed in. Since it looks like there is not it simply returned toLowerCase( to the screen.

Then to get back to the last command he simply pressed the up arrow on this keyboard to continue the command. Obviously you could also pass in a string to return that string as all lowercase.

John Loön
John Loön
477 Points

Thanks a lot for your help and patience! I think I'm just gonna move on from this exercise and try the next one. Eventually my issue will appear again I guess and I can tackle it from another viewpoint. I'm really new to all of this with all the new terms and stuff and everything in english which is not my first language. I'll just keep on struggling! Thanks again! John