Programming

Kotlin ArrayList and Loops Example

Kotlin ArrayList Kotlin ArrayList is also very similar to Java Arraylist. ArrayList<T> is the resizable-array implementation of the List interface. The ArrayList class has only a few methods in addition to the methods available in the List interface. val myArrayList = arrayListOf(“John”, “Fred”, “McKinsey”, “Morgan”, “Sarah”) //an arraylist of my friends val newFriendList = arrayListOf(“Musa”, “Victor”, “Timothy”) myArrayList.add(0, …

Kotlin ArrayList and Loops Example Read More »

Kotlin: Array vs List – Similarities and Differences

// Initializing array and list val array = arrayOf(1, 2, 3) val list = listOf(“apple”, “ball”, “cow”) val mixedArray = arrayOf(true, 2.5, 1, 1.3f, 12000L, ‘a’) // mixed Array val mixedList = listOf(false, 3.5, 2, 1.4f, 13000L, ‘b’) // mixed List Arrays An array is a container object that holds a fixed number of values …

Kotlin: Array vs List – Similarities and Differences Read More »

Kotlin For Dummies: Variables, Basic Types, and Arrays

1. Variables In Kotlin, we use “val” to declare a constant or “var” keywords to declare a variable. You can specify a type such as String or Int after the variable name. In the example below, we declared a constant firstName of type String with the val keyword. val firstName: String = “Opeyemi” // this is …

Kotlin For Dummies: Variables, Basic Types, and Arrays Read More »

What is Object Oriented Programming

What is Object Oriented Programing?

Object Orientation is the most widely used programming paradigm there is, every major programming language uses object-oriented programming principles and that includes Java, Python, C++, C#, PHP, Swift etc and it includes Kotlin. Objected Oriented Programming (OOP) dates back to the 1980s OOP is a natural way to model software and probably one of the …

What is Object Oriented Programing? Read More »

OOP – Differences between Methods and Functions

Basically there is not much difference between them (method and functions). //Car Class class Car { private String name; private String color; private int topSpeed; public Car(String name, String color, int topSpeed) { this.name = name; this.color = color; this.topSpeed = topSpeed; } public void accelerate() { //vooom! } } Differences Method  it is always called …

OOP – Differences between Methods and Functions Read More »