SlideShare a Scribd company logo
1 of 38
This work is licensed under the Apache 2.0 License
WELCOME TO
COMPOSE CAMP
SESSION 1
01-OCTOBER-2022
5:00 PM - 6:00 PM
This work is licensed under the Apache 2.0 License
Jenil Nagrecha
IIT Patna | EEE'24
Facilitator
LinkedIn
I am currently pursuing Electrical and Electronics
Engineering from IIT Patna I've been making mobile
apps for a year by using Android and flutter, I am also
an active member of open-source community for
flutter apps and have created a few apps of my own
you can visit my GitHub profile to know more about my
projects!!
This work is licensed under the Apache 2.0 License
Android studio
Installation
Android
Studio Basics
Kotlin
Playground
Learn Basics of Kotlin and
How to use it in Android
Studio.
Learn Basics of Android
Studio and Lookout on
Features of Android
Studio.
Install and set up Android
Studio, so that you can
create your first project
and run it on a device or
emulator.
Topics For Session 1 -
Kotlin Playground
This work is licensed under the Apache 2.0 License
Android Studio
Android Studio is the official integrated development environment
(IDE) for Android app development built and distributed by Google.
An IDE contains tools that make it easy for software developers to
design, build, run, and test software, in this case, apps for the
Android platform. Android Studio uses IntelliJ IDEA as its foundation
and includes the Android plugin pre-installed along with some
modifications specifically for the Android platform.
This work is licensed under the Apache 2.0 License
Installation steps - Windows
The following are the system requirements for Android Studio on Windows.
● 64-bit Microsoft® Windows® 8/10/11
● x86_64 CPU architecture; 2nd generation Intel Core or newer, or AMD CPU with
support for a Windows Hypervisor
● 8 GB RAM or more
● 8 GB of available disk space minimum (IDE + Android SDK + Android Emulator)
● 1280 x 800 minimum screen resolution
Check system requirements
Download and install
Android Studio
Download Android Studio from the Android Studio download page.
You can Follow this Link for installation - Installation Guide refer this link
Welcome to Android Studio 🥳🎉
This work is licensed under the Apache 2.0 License
Refer to this link
Here’s How to create a new project
This work is licensed under the Apache 2.0 License
Android Studio Overview (Refer to this link)
This work is licensed under the Apache 2.0 License
WELCOME TO
COMPOSE CAMP
SESSION 2
01-OCTOBER-2022
6:00 PM - 7:00 PM
This work is licensed under the Apache 2.0 License
Doubts
Express any doubts you
facing in any of above
things we will be
discussing.
AVD is a system installed
on your machine which
enables us to install apps
in android without any
physical device.
Topics For Session 2-
AVD Setup
This work is licensed under the Apache 2.0 License
Setup AVD
In this task, you'll use the Device Manager to create an Android Virtual
Device (AVD). An AVD is a software version, also called an emulator, of a
mobile device that runs on your computer and mimics the configuration of
a particular type of Android device. This could be any phone, tablet, TV,
watch, or Android auto device. You'll use the AVD to run the Birthday Card
app.
refer to link
This work is licensed under the Apache 2.0 License
Setup AVD refer to link
This work is licensed under the Apache 2.0 License
This work is licensed under the Apache 2.0 License
This work is licensed under the Apache 2.0 License
How to
connect
your
Android
device
This work is licensed under the Apache 2.0 License
Enable USB Debugging
● On your Android device, tap Settings > About phone.
● Tap Build number seven times.
● If prompted, enter your device password or pin. You know
you succeeded when you see a You are now a developer!
message.
refer to link
This work is licensed under the Apache 2.0 License
From here in computer, you can run
your Android app in AVD or
physical Android device(Just select
the device and click on play button)
This work is licensed under the Apache 2.0 License
Kotlin PlayGround
● Variables
● Functions
● Write conditionals in Kotlin
● Use nullability in Kotlin
● Use classes and objects in Kotlin
● Use function types and lambda expressions in Kotlin
This work is licensed under the Apache 2.0 License
Variable and data types refer to link
This work is licensed under the Apache 2.0 License
Variable and data types
fun main() {
val count: Int = 2
println("You have $count unread messages.")
}
OUTPUT : You have 2 unread messages.
refer to link
This work is licensed under the Apache 2.0 License
String :
fun main() {
val nextMeeting = "Next meeting is:"
val date = "January 1"
val reminder = nextMeeting + date
println(reminder)
}
OUTPUT : Next meeting is:January 1
refer to link
This work is licensed under the Apache 2.0 License
Double :
fun main() {
val trip1: Double = 3.20
val trip2: Double = 4.10
val trip3: Double = 1.72
val totalTripLength: Double = trip1 + trip2 + trip3
println("$totalTripLength miles left to destination")
}
OUTPUT : 9.02 miles left to destination
This work is licensed under the Apache 2.0 License
Boolean :
fun main() {
val notificationsEnabled: Boolean = false
println("Are notifications enabled? " + notificationsEnabled)
}
OUTPUT : Are notifications enabled? false
This work is licensed under the Apache 2.0 License
Functions in Kotlin
fun main() {
birthdayGreeting()
}
fun birthdayGreeting() {
println("Happy Birthday, Rover!")
println("You are now 5 years old!")
}
OUTPUT : Happy Birthday, Rover!
You are now 5 years old!
refer to link
This work is licensed under the Apache 2.0 License
Return a value from Function
fun birthdayGreeting(): String {
val nameGreeting = "Happy Birthday, Rover!"
val ageGreeting = "You are now 5 years old!"
return "$nameGreetingn$ageGreeting"
}
OUTPUT : Happy Birthday, Rover!
You are now 5 years old!
fun main() {
val greeting = birthdayGreeting()
println(greeting)
}
refer to link
This work is licensed under the Apache 2.0 License
Add a parameter to a function
fun birthdayGreeting(name: String): String {
val nameGreeting = "Happy Birthday, $name!"
val ageGreeting = "You are now 5 years old!"
return "$nameGreetingn$ageGreeting"
}
OUTPUT : Happy Birthday, REX!
You are now 5 years old!
fun main() {
println(birthdayGreeting("REX"))
}
refer to link
This work is licensed under the Apache 2.0 License
Add parameters to a function
fun birthdayGreeting(name: String, age: Int): String {
val nameGreeting = "Happy Birthday, $name!"
val ageGreeting = "You are now $age years old!"
return "$nameGreetingn$ageGreeting"
}
OUTPUT : Happy Birthday, REX!
You are now 6 years old!
fun main() {
println(birthdayGreeting("REX", 6))
}
This work is licensed under the Apache 2.0 License
Write Conditionals
● If/Else condition -
This work is licensed under the Apache 2.0 License
If/Else Condition
● Take an example over here -
fun main() {
val trafficLightColor = "Black"
if (trafficLightColor == "Red") {
println("Stop")
} else if (trafficLightColor =="Yellow")
{
println("Slow")
} else {
println("Go")
}
}
refer to link
This work is licensed under the Apache 2.0 License
Write Conditionals
● When conditional -
This work is licensed under the Apache 2.0 License
When Conditional
● Take an example over here -
fun main() {
val trafficLightColor = "Yellow"
when (trafficLightColor) {
"Red" -> println("Stop")
"Yellow" -> println("Slow")
"Green" -> println("Go")
else -> println("Invalid traffic-light color")
}
}
refer to link
This work is licensed under the Apache 2.0 License
Nullability in Kotlin
In Unit 1, you learned that when you declare a variable, you need to assign it a value
immediately. For example, when you declare a Favourite Actor variable, you may assign
it a "Sandra" string value immediately.
what if you don't have a
favorite actor?
refer to link
This work is licensed under the Apache 2.0 License
Nullability in Kotlin
Nullable vs Non-nullable Variables
fun main() {
var favoriteActor: String =
"Sandra Oh"
favoriteActor = null
println(favoriteActor)
}
Output Error :
fun main() {
var favoriteActor: String? =
"Sandra Oh"
println(favoriteActor)
favoriteActor = null
println(favoriteActor)
}
Output :
Sandra Oh
null
refer to link
This work is licensed under the Apache 2.0 License
Classes and Objects
● Defining a Class -
class SmartDevice {
// empty body
}
fun main() {
}
refer to link
This work is licensed under the Apache 2.0 License
Classes and Objects
● Defining class methods -
class SmartDevice {
fun turnOn(){
println("Smart device is turned on.")
}
fun turnOff(){
println("Smart device is turned off.")
}
}
fun main() {
val smartTvDevice = SmartDevice()
smartTvDevice.turnOn()
smartTvDevice.turnOff()
}
refer to link
This work is licensed under the Apache 2.0 License
Classes and Objects
● Defining class properties -
class SmartDevice {
val name = "Android TV"
val category = "Entertainment"
var deviceStatus = "online"
fun turnOn(){
println("Smart device is turned on.")
}
fun turnOff(){
println("Smart device is turned off.")
}
}
fun main(){
val smartTvDevice = SmartDevice()
println("Device name is: ${smartTvDevice.name}")
smartTvDevice.turnOn()
smartTvDevice.turnOff()
}
refer to link
Must Read
This work is licensed under the Apache 2.0 License
Thankyou
See you in session 3
and 4..

More Related Content

Featured

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Compose_Camp_Session_1_2.pptx

  • 1. This work is licensed under the Apache 2.0 License WELCOME TO COMPOSE CAMP SESSION 1 01-OCTOBER-2022 5:00 PM - 6:00 PM
  • 2. This work is licensed under the Apache 2.0 License Jenil Nagrecha IIT Patna | EEE'24 Facilitator LinkedIn I am currently pursuing Electrical and Electronics Engineering from IIT Patna I've been making mobile apps for a year by using Android and flutter, I am also an active member of open-source community for flutter apps and have created a few apps of my own you can visit my GitHub profile to know more about my projects!!
  • 3. This work is licensed under the Apache 2.0 License Android studio Installation Android Studio Basics Kotlin Playground Learn Basics of Kotlin and How to use it in Android Studio. Learn Basics of Android Studio and Lookout on Features of Android Studio. Install and set up Android Studio, so that you can create your first project and run it on a device or emulator. Topics For Session 1 - Kotlin Playground
  • 4. This work is licensed under the Apache 2.0 License Android Studio Android Studio is the official integrated development environment (IDE) for Android app development built and distributed by Google. An IDE contains tools that make it easy for software developers to design, build, run, and test software, in this case, apps for the Android platform. Android Studio uses IntelliJ IDEA as its foundation and includes the Android plugin pre-installed along with some modifications specifically for the Android platform.
  • 5. This work is licensed under the Apache 2.0 License Installation steps - Windows The following are the system requirements for Android Studio on Windows. ● 64-bit Microsoft® Windows® 8/10/11 ● x86_64 CPU architecture; 2nd generation Intel Core or newer, or AMD CPU with support for a Windows Hypervisor ● 8 GB RAM or more ● 8 GB of available disk space minimum (IDE + Android SDK + Android Emulator) ● 1280 x 800 minimum screen resolution Check system requirements
  • 6. Download and install Android Studio Download Android Studio from the Android Studio download page. You can Follow this Link for installation - Installation Guide refer this link
  • 7. Welcome to Android Studio 🥳🎉
  • 8. This work is licensed under the Apache 2.0 License Refer to this link Here’s How to create a new project
  • 9. This work is licensed under the Apache 2.0 License Android Studio Overview (Refer to this link)
  • 10. This work is licensed under the Apache 2.0 License WELCOME TO COMPOSE CAMP SESSION 2 01-OCTOBER-2022 6:00 PM - 7:00 PM
  • 11. This work is licensed under the Apache 2.0 License Doubts Express any doubts you facing in any of above things we will be discussing. AVD is a system installed on your machine which enables us to install apps in android without any physical device. Topics For Session 2- AVD Setup
  • 12. This work is licensed under the Apache 2.0 License Setup AVD In this task, you'll use the Device Manager to create an Android Virtual Device (AVD). An AVD is a software version, also called an emulator, of a mobile device that runs on your computer and mimics the configuration of a particular type of Android device. This could be any phone, tablet, TV, watch, or Android auto device. You'll use the AVD to run the Birthday Card app. refer to link
  • 13. This work is licensed under the Apache 2.0 License Setup AVD refer to link
  • 14. This work is licensed under the Apache 2.0 License
  • 15. This work is licensed under the Apache 2.0 License
  • 16. This work is licensed under the Apache 2.0 License How to connect your Android device
  • 17. This work is licensed under the Apache 2.0 License Enable USB Debugging ● On your Android device, tap Settings > About phone. ● Tap Build number seven times. ● If prompted, enter your device password or pin. You know you succeeded when you see a You are now a developer! message. refer to link
  • 18. This work is licensed under the Apache 2.0 License From here in computer, you can run your Android app in AVD or physical Android device(Just select the device and click on play button)
  • 19. This work is licensed under the Apache 2.0 License Kotlin PlayGround ● Variables ● Functions ● Write conditionals in Kotlin ● Use nullability in Kotlin ● Use classes and objects in Kotlin ● Use function types and lambda expressions in Kotlin
  • 20. This work is licensed under the Apache 2.0 License Variable and data types refer to link
  • 21. This work is licensed under the Apache 2.0 License Variable and data types fun main() { val count: Int = 2 println("You have $count unread messages.") } OUTPUT : You have 2 unread messages. refer to link
  • 22. This work is licensed under the Apache 2.0 License String : fun main() { val nextMeeting = "Next meeting is:" val date = "January 1" val reminder = nextMeeting + date println(reminder) } OUTPUT : Next meeting is:January 1 refer to link
  • 23. This work is licensed under the Apache 2.0 License Double : fun main() { val trip1: Double = 3.20 val trip2: Double = 4.10 val trip3: Double = 1.72 val totalTripLength: Double = trip1 + trip2 + trip3 println("$totalTripLength miles left to destination") } OUTPUT : 9.02 miles left to destination
  • 24. This work is licensed under the Apache 2.0 License Boolean : fun main() { val notificationsEnabled: Boolean = false println("Are notifications enabled? " + notificationsEnabled) } OUTPUT : Are notifications enabled? false
  • 25. This work is licensed under the Apache 2.0 License Functions in Kotlin fun main() { birthdayGreeting() } fun birthdayGreeting() { println("Happy Birthday, Rover!") println("You are now 5 years old!") } OUTPUT : Happy Birthday, Rover! You are now 5 years old! refer to link
  • 26. This work is licensed under the Apache 2.0 License Return a value from Function fun birthdayGreeting(): String { val nameGreeting = "Happy Birthday, Rover!" val ageGreeting = "You are now 5 years old!" return "$nameGreetingn$ageGreeting" } OUTPUT : Happy Birthday, Rover! You are now 5 years old! fun main() { val greeting = birthdayGreeting() println(greeting) } refer to link
  • 27. This work is licensed under the Apache 2.0 License Add a parameter to a function fun birthdayGreeting(name: String): String { val nameGreeting = "Happy Birthday, $name!" val ageGreeting = "You are now 5 years old!" return "$nameGreetingn$ageGreeting" } OUTPUT : Happy Birthday, REX! You are now 5 years old! fun main() { println(birthdayGreeting("REX")) } refer to link
  • 28. This work is licensed under the Apache 2.0 License Add parameters to a function fun birthdayGreeting(name: String, age: Int): String { val nameGreeting = "Happy Birthday, $name!" val ageGreeting = "You are now $age years old!" return "$nameGreetingn$ageGreeting" } OUTPUT : Happy Birthday, REX! You are now 6 years old! fun main() { println(birthdayGreeting("REX", 6)) }
  • 29. This work is licensed under the Apache 2.0 License Write Conditionals ● If/Else condition -
  • 30. This work is licensed under the Apache 2.0 License If/Else Condition ● Take an example over here - fun main() { val trafficLightColor = "Black" if (trafficLightColor == "Red") { println("Stop") } else if (trafficLightColor =="Yellow") { println("Slow") } else { println("Go") } } refer to link
  • 31. This work is licensed under the Apache 2.0 License Write Conditionals ● When conditional -
  • 32. This work is licensed under the Apache 2.0 License When Conditional ● Take an example over here - fun main() { val trafficLightColor = "Yellow" when (trafficLightColor) { "Red" -> println("Stop") "Yellow" -> println("Slow") "Green" -> println("Go") else -> println("Invalid traffic-light color") } } refer to link
  • 33. This work is licensed under the Apache 2.0 License Nullability in Kotlin In Unit 1, you learned that when you declare a variable, you need to assign it a value immediately. For example, when you declare a Favourite Actor variable, you may assign it a "Sandra" string value immediately. what if you don't have a favorite actor? refer to link
  • 34. This work is licensed under the Apache 2.0 License Nullability in Kotlin Nullable vs Non-nullable Variables fun main() { var favoriteActor: String = "Sandra Oh" favoriteActor = null println(favoriteActor) } Output Error : fun main() { var favoriteActor: String? = "Sandra Oh" println(favoriteActor) favoriteActor = null println(favoriteActor) } Output : Sandra Oh null refer to link
  • 35. This work is licensed under the Apache 2.0 License Classes and Objects ● Defining a Class - class SmartDevice { // empty body } fun main() { } refer to link
  • 36. This work is licensed under the Apache 2.0 License Classes and Objects ● Defining class methods - class SmartDevice { fun turnOn(){ println("Smart device is turned on.") } fun turnOff(){ println("Smart device is turned off.") } } fun main() { val smartTvDevice = SmartDevice() smartTvDevice.turnOn() smartTvDevice.turnOff() } refer to link
  • 37. This work is licensed under the Apache 2.0 License Classes and Objects ● Defining class properties - class SmartDevice { val name = "Android TV" val category = "Entertainment" var deviceStatus = "online" fun turnOn(){ println("Smart device is turned on.") } fun turnOff(){ println("Smart device is turned off.") } } fun main(){ val smartTvDevice = SmartDevice() println("Device name is: ${smartTvDevice.name}") smartTvDevice.turnOn() smartTvDevice.turnOff() } refer to link Must Read
  • 38. This work is licensed under the Apache 2.0 License Thankyou See you in session 3 and 4..