Hola! Hope you are excited to learn Kotlin and start your Android app development journey.

I believe that you have just begun your development journey so we will be focusing on some of the important concepts like, Object-oriented programming system.

  1. Object-Oriented Programming System (OOPs)
  2. Constructors [ Primary Constructor and Secondary Constructor ]
  3. Inheritance
  4. Abstract Classes
  5. Interface
  6. Exception Handling

But first of all, we will start by learning OOPs, Class , Methods and Objects.

Let us hear a story of Steve and Ray. Both of them decided to code in two different ways, one is “Procedural programming” and another is “Object-oriented programming”. So basically, these are two styles of writing code.

Steve has solved the program by making functions, but Ray has solved it by using class and for using the class, Ray has created some objects.

Eg. student is an object and under objects, there are a lot of properties of the object ‘student’ which are name, rollno, studentId.

Now the question arises, ‘What is a class?’

Classes are the main building blocks of any object-oriented programming language. All objects are part of a class and share the common property and behavior defined by the class in form of data members and member functions respectively.

As we can not create any direct objects in Java, Kotlin, you need to define a class and through class, you can access the properties via objects. A class shows the blueprint of the objects, you can also say the class is a prototype or class is a logical entity, we can’t use the class directly. Hence we only use class to create objects. We can create instance variables(data) and methods (fun)

“Toh agar tumhe ghar banana ho toh, tum pehle design banaoge ,then ghar banaoge, right?” so, class is the design and ‘ghar’ is an object with its properties.

if () is empty, it’s fine but if you have added something inside () then add the value of it in object’s function.

For eg: className( here)

Object is a real-world entity, we can use the variables or fun that we create in the class through objects. Object is an implementation of the class.

Syntax:

Val ob= Student() // Students() is the name of the class and ob is object

Let us see some code, copy it, and run it on the compiler:

--

--

--

A leader with a Vison -> Learn, Explore , Create

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

This Giant E-Ink Tablet Is a Dream Device for Reading and Taking Notes

Keep Random Beacon | Node Monitoring | Part 2

Are Some Infinities Bigger Than Others?

JWT Auth in ASP.NET Core

451PCBcom (PCB) whitepaper v2.1 released.

Indie Mac App DevOps With GitHub Actions

Send your ML model to the “Cloud Nine” using the Serverless Application Model (SAM)

Elm Gives Us Human-Level Event Logging Almost for Free

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Souhardya Bose

Souhardya Bose

A leader with a Vison -> Learn, Explore , Create

More from Medium

WHAT IS A COROUTINE?

fragment stuck cannot move to another fragment in Android Navigation

MESA——wait notifyall

How to force turned on the GPU acceleration of Android Webview