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.


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:



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