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 trialalbert gutierrrez
Courses Plus Student 964 PointsJust wondering...
Hi.. I just want to ask something.. all the videos that i watched from this part of the course is that Sir Craig is using data types that are mostly int and Strings .. and if the string is being "called" on the String sample = "sample string"; System.out.println("This example %s",sample); the %s indicates that, that is a String..but how about for Float? how does the float differ from the String ? thanks ... I'm just a newbie here :D
1 Answer
Michael Hess
24,512 PointsHi Albert,
The float data type is a single-precision 32-bit IEEE 754 floating point. Its range of values is beyond the scope of this discussion, but is specified in the Floating-Point Types, Formats, and Values section of the Java Language Specification. As with the recommendations for byte and short, use a float (instead of double) if you need to save memory in large arrays of floating point numbers.
Strings, which are widely used in Java programming, are a sequence of characters. In the Java programming language, strings are objects.
You may want to read the following for a deeper understanding of primitive data types and Strings in Java:
If you have any further questions feel free to ask!
albert gutierrrez
Courses Plus Student 964 Pointsalbert gutierrrez
Courses Plus Student 964 PointsOk thank you for the answer :D I'll read deeply for the link that you provide and hope to get a better understanding of how java works.
Michael Hess
24,512 PointsMichael Hess
24,512 PointsMy pleasure!