Kotlin at a glance
eBook - ePub

Kotlin at a glance

Use of Lambdas and higher-order functions to write more concise, clean, reusable, and simple code

  1. English
  2. ePUB (mobile friendly)
  3. Available on iOS & Android
eBook - ePub

Kotlin at a glance

Use of Lambdas and higher-order functions to write more concise, clean, reusable, and simple code

About this book

Basic guide to develop an App in Android by using Kotlin Key Features

  • Comprehensive coverage of all the concepts of Kotlin
  • Simple language, crystal clear approach, user friendly book
  • Concepts are duly supported by several examples and self-explanatory analogies.


Description
"Kotlin at a Glance" is a book that gives an in-depth knowledge about Kotlin. This book mainly focused on Kotlin programming language and its comparison to Java. By reading this book, the readers can make themselves familiar with the language's most important features and aspects.With a complete overview of OOPs, null safety, generics, and many other interesting features, this book is a perfect choice for fresher and experienced Java developers who want to learn more about this alternative JVM language.For reading this book, there's no need for any prior Kotlin knowledge, as the basics are explained in the book. Moreover, the required functional programming concepts are also described.The readers of this book will also learn to develop an app in android using Kotlin. Moreover, this book is for everyone who is on their way of becoming a developer. What will you learn

  • Introduction to OOP, Java, Kotlin
  • Kotlin Architecture, Token, Input, Operator, Array, Function
  • Looping / Control Flow / Iteration
  • Null Safety, Kotlin Lambda Functions and Exception Handling
  • Constructor, Inheritance, Abstract Keyword, Polymorphism
  • Collection, Coroutines, Generics
  • Regex, Interoperability with Java, Android
  • Who this book is for
    This book will prove to be a "must-have" for beginners as well as experienced professionals as it is a stepping stone for learning the technology. Table of Contents
    1. OOP in Brief
    2. An Introduction to Java
    3. An Introduction to Kotlin
    4. Kotlin Architecture
    5. Kotlin Token
    6. Kotlin Input
    7. Kotlin Operator
    8. String Operations
    9. Conditional Statements
    10. Jumping Statement
    11. Looping / Control Flow / Iteration
    12. Kotlin Array
    13. Null Safety
    14. Kotlin Function
    15. Function Scope
    16. Kotlin Lambda Functions and Exception Handling
    17. Kotlin OOPs
    18. Constructor
    19. Inheritance
    20. Abstract Keyword
    21. Polymorphism
    22. Collection
    23. Coroutines
    24. Generics
    25. Regex
    26. Interoperability with Java
    27. Kotlin for Android
    28. Extras
    29. Interoperability with JavaScript
    30. Glossary
    31. Important Question About the Author
    Swati Saxena is expert in Java programming and coding as she is MCA, OCJP ( Oracle Certified Java Professional ) and ADST, having in-depth knowledge of subject and very vast experience in developing and training. Her knowledge and teaching is always praised by her mentor as well as students. She has written "C programming and coding Question Bank with solution', "Java-A Complete Practical Solution" for BPB Publications. The alumnus of her, are well placed in many reputed organisations all over India.

Frequently asked questions

Yes, you can cancel anytime from the Subscription tab in your account settings on the Perlego website. Your subscription will stay active until the end of your current billing period. Learn how to cancel your subscription.
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
Perlego offers two plans: Essential and Complete
  • Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
  • Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Both plans are available with monthly, semester, or annual billing cycles.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Yes! You can use the Perlego app on both iOS or Android devices to read anytime, anywhere — even offline. Perfect for commutes or when you’re on the go.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app.
Yes, you can access Kotlin at a glance by Swati Saxena in PDF and/or ePUB format, as well as other popular books in Computer Science & Operating Systems. We have over one million books available in our catalogue for you to explore.

CHAPTER 1

OOP in Brief

OOP stands for object-oriented programming, refers to a programming methodology based on objects, instead of just functions and procedures.

Advantage of OOPs Over Procedure-oriented Programming Language

  • OOPs makes development and maintenance easier, where as, in procedure-oriented programming language, it is not easy to manage the code if it grows as the project size grows.
  • OOPs provides data hiding, whereas, in procedure-oriented programming language, a global data can be accessed from anywhere.
  • OOPs provides the ability to simulate real-world events much more effectively.
  • We can provide the solution of real world problem if we are using object-oriented programming languages.
What is an object?
An object is an entity which has a well-defined structure and behavior. Everything in world is an object if it has some identity, state, behavior, and responsibility.
Characteristics of an object:
  • State
  • Behavior
  • Identity
  • Responsibility

Features of OOP

The features of OOP are as follows:
  • Abstraction
  • Encapsulation
  • Inheritance
  • Polymorphism

Abstraction

Abstraction is the process of identifying the key aspects of an entity and ignoring the rest. Data abstraction is a programming (and design) technique that relies on the separation of interface and implementation.
Advantages of data abstraction are:
  • It makes the application secure by making data private and avoiding the user-level error that may corrupt the data
  • It avoids code duplication
For example, a man has all the following properties but according to the need he is asked for the following information:
Social Survey Health Care Employment
Name
Name
Name
Age
Age
Age
Marital status
Address
Address
Religion
Blood group
Qualification
Income group
Weight
Department
Address
Previous record
Job responsibility
…….
……..
……..

Encapsulation

Encapsulation is a mechanism used to hide the data, internal structure, and implementation details of an object.
Data encapsulation led to the important OOP concept of data hiding. Data encapsulation is a mechanism of bundling the data, and the functions that use them and data abstraction is a mechanism of exposing only the interfaces and hiding the implementation details from the user.
C++ supports the properties of encapsulation and data hiding through the creation of user-defined types, called classes.
Advantages of encapsulation:
  • Encapsulation is useful in hiding the data of a class from an illegal direct access
  • Encapsulation helps us in binding the data and the member functions of a class
  • Encapsulation also helps us to make a flexible code which is easy to change and maintain
The main advantage of encapsulation is to protect the data from outside by giving access control. Encapsulation is the complement of abstraction.

Inheritance

Inheritance is the process by which one object can acquire the properties of another object.
When creating a class, instead of writing completely new data members and member functions, the programmer can designate that the new class should inherit the members of an existing class. This existing class is called the base/parent class, and the new class is referred to as the derived/child class.
Inheritance implements the “is a” relationship. For example, car is a vehicle.
In C++, you ca...

Table of contents

  1. Cover
  2. Kotlin at a Glance
  3. Copyright
  4. Dedication
  5. Preface
  6. Table of Contents
  7. Chapter 1: OOP in Brief
  8. Chapter 2: An Introduction to Java
  9. Chapter 3 An Introduction to Kotlin
  10. Chapter 4: Kotlin Architecture
  11. Chapter 5: Kotlin Token
  12. Chapter 6: Kotlin Input
  13. Chapter 7: Kotlin Operator
  14. Chapter 8: String Operations
  15. Chapter 9:Conditional Statements
  16. Chapter 10: Jumping Statement
  17. Chapter 11: Looping / Control Flow / Iteration
  18. Chapter 12: Kotlin Array
  19. Chapter 13: Null Safety
  20. Chapter 14: Kotlin Function
  21. Chapter 15: Function Scope
  22. Chapter 16: Kotlin Lambda Functions and Exception Handling
  23. Chapter 17: Kotlin OOPs
  24. Chapter 18: Constructor
  25. Chapter 19: Inheritance
  26. Chapter 20: Abstract Keyword
  27. Chapter 21: Polymorphism
  28. Chapter 22: Collection
  29. Chapter 23: Coroutines
  30. Chapter 24: Generics
  31. Chapter 25: Regex
  32. Chapter 26: Interoperability with Java
  33. Chapter 27: Kotlin for Android
  34. Chapter 28: Extras
  35. Chapter 29: Interoperability with JavaScript
  36. Glossary
  37. Important Question