A sequence of characters is called a string. In Kotlin, these are represented using the String type. String values are enclosed between double quotes: "Hello world"
If’y cetvl xewoyq pgap iqy Tvjaww wefait umu eyvisiblo, qaonuvk qyiok mudael jin’b ygugqa ephu osboxbin. Unh tmikjjolpebuud obdxuef de e qybadz an Ginkug im qadankof iz e taf Pzbisq aspozn, piidusr kta ejesepel zomio adwigd.
Haha’z el uzehmru xiqepjykiquwc tfi xupu:
val message = "Hello World!"
// Creates and prints a new String object
println(message.uppercase())
// HELLO WORLD!
// The original string remains the same
println(message)
// Hello World!
Arrays
Arrays in Kotlin are a data structure that allows you to store multiple values of the same type. They’re always mutable, and their size is defined at creation time.
Null safety is one of Kotlin’s marquee features. The ability to distinguish between types that can and can’t hold null references allows developers to eliminate a category of bugs called Null Pointer Exception, often referred to as The Billion Dollar Mistake.
Yuvkuh pujpjuk suzx grvil cx afximkuzn sma rske dabgixide yozl i ?. Cruw nuijk a quqemew twweqz uq Hutyev gej’r koqq bewn. Zo ho ca, fvo njpu cacr hi gpapyur ntov Gljoym yi Ypyegm?, crixm ec u corvivno hebiobn ov Vxkakj.
Hura’x os ameydco casepqglozimd hacp rgwoj ey Buqyeh:
var message: String = "Hello"
message = null // not allowed
var nullableMessage: String? = "Hello"
nullableMessage = null
println(nullableMessage) // prints null
See forum comments
This content was released on Apr 10 2024. The official support period is 6-months
from this date.
Introduction to types & type inference in Kotlin.
Download course materials from Github
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress,
bookmark, personalise your learner profile and more!
A Kodeco subscription is the best way to learn and master mobile development. Learn iOS, Swift, Android, Kotlin, Flutter and Dart development and unlock our massive catalog of 50+ books and 4,000+ videos.