Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Build a Simple Android App (2014) Getting Started with Android Troubleshooting Java

strings

do I add the word String each time I add a new varible?

1 Answer

Daniel Hartin
Daniel Hartin
18,106 Points

Hi Connie

The key word String defines the type of variable you want to create, there are lots of different data types that are available to you and you can create your own Objects if you wish (probably a little more advanced). It all depends on what you want to store in the variable

Strings store letters, sentences, entire pages of text if you wish, do beware of storing numbers in String formats, as while this will work adding the string "2" to the String "3" doesn't equal 5 it equals "23" (data types are covered in detail as you move through the android and/or Java tracks).

There are some oracle docs in the link below if you would like to read up on data types https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html

A short, some what unhelpful answer to your question do you have to type String every time is yes if you want to store sentences and no if you want to store numbers.

Hope this helps

Daniel