Showing posts with label Studio. Show all posts
Showing posts with label Studio. Show all posts

Using String Variable with Kotlin Programming Language |Part-2|

String Variable with Kotlin


Hello Everyone here, Creating another video to demonstrate how to use String Variables in Android Studio using Kotlin Programming language.



Software: Android Studio
Programming Language: Kotlin


Its a beginner example and Part two of my Kotlin Programming Guide.

To declare any variable in Kotlin, you can simply use two keywords.

Var and Val

First, we are going to use Var Variables is the General variable that can be changed anytime throughout the Kotlin programming.

However, the Val variables are the constraint variables and can be declared only once.

Practice tasks

1. Open Android Studio and go to your project > Java > <com.folder> and edit the Kotlin file to create the variable:

fun main()
var name = "James"
val lname = "McDonald"

Result: Run the compilation and see what happens, Check for error and update it here in comments.

2. Try to reassign a new value to the "var" variable name and the "val" variable lname and see if we can change the value at the later point during our program.

Result: Share the error, if any.

3.  Assign null values to the variables and check out for the outcome. Check for error.
Assign null String declaration to the available by using

:String? Next to the variable name.

Result: Share the error, if any.

We can also assign variables outside the function as well using this method variable will be easily accessible to the other Functions throughout the program.

While declaring the string variable, you may think about how the program decides what kind of variable it. Kotlin chooses the type of variable with very first user input. Like when you mentioned string value to the variable with the quotes that time it assigned, they string type to the variable, and that variable name will remain String Variable throughout the program.
Similarly, if we are going to assign Integer or Float value to the variable for the very first time, it will take is as the Float/Integer variable. We will discuss other types of variables in another post in more detail.

Kotlin Program "Hello World" codded using Android Studio |Part-1|

Kotlin- Part 1


 This article describes how to compline Kotlin programming inside the Android Studio for beginners tutorial.


OS: Windows 10
Application: Android Studio


Kotlin is an alternative JVM programing language to create Android Application.

Most of the learners start learning Kotlin with IntelliJ and later start to work on Android Studio.

However, the learners can, from the beginning, learn this on Android studio.

In a small series of tutorials on Kotlin Programming, we introduced the tutorial to do a Kotlin Programming directly on Android Studio. In Part-1, we have a quick demonstration of running a "Hello World" program in the Android Studio application.

Kotlin Programming using Android Studio:

We welcome all our viewers to watch the video of the easy to use Kotlin programming to print "Hello World" into the Android Studio Terminal.

Some related questions:

What is IntelliJ?
Answer: IntelliJ is an Integrated Development Environment(IDE) software written in Java for making software. It was developed by Jetbrains(formally known as IntelliJ) in 2001 to Develop Java-based software with more sophistication; to learn more about IntelliJ history, please visit the Wiki link for IntelliJ.
What is Android Studio?

Android Studio is another IDE that is based upon IntelliJ and is specifically designed to create Android-based applications.
Wiki link to Android Studio.

What is Kotlin?

Java is a language that we still use to create as a preferred language to make Android applications. However, Jetbrains developed the programming language as an alternative to Java named it as Kotline, a new language buddle with more sophistication, ease, and it supports multiple platforms.
Wiki Link to Kotlin


Enter your email address:

Delivered by FeedBurner