Reputation: 11
I'm about to take a course in computer science and have some decent knowledge in T-SQL and that's it.
The pre reading for this course is not well written. Having trouble how they are getting certain result sets. Here is Groovy
statement
String str
print "Please key in a word: "
str = System.console().readline()
print "The word was: "
println str
Result
Please key in a word: Tom
The word was : Tom
Where on earth did they assign or set str = "Tom"
. I understand variables but have never come across system.console().readLine()
so maybe i am missing something?
Clearly the pre reading is meant to suggest that I type in value Tom but actually hasn't bothered to show me where.
Regards
Tom
Upvotes: 1
Views: 3267
Reputation: 2646
readline()
is a method. It does return
something. In this case a string.
str = System.console().readline()
is an assignment because you use =
, the assignment operator.
Upvotes: 2