Pages

Thursday, May 10, 2018

START KOTLIN 1


Hi friends lets start to learn kotlin i will make it as simple as possible its is also prepared for beginners so for them i advice not to by heart this lessons just understand it

 

                          Kotlin is a functional language and very easy to learn the syntax is very similar to java code so those who know java will be a great advantage  it is accepted as the first official language of android development

                              First we need to install java 8: Kotlin runs on JVM, hence. it is really necessary to use JDK 8 for your local Kotlin development. you have to set the environment variable for JAVA such that it can work properly if you dont know then you can google it. To verify your installation in Windows operating system, hit “java –version” in the command prompt and as an output it will show you the java version installed in your system. To install java go to this link  and install version jdk8 or above.

                            And then you have to install an IDE for your work you can install any one which works with kotlin for example NetBeans,Intellij,Eclipse It is always recommended to use the recent software version to drag out maximum facility from it.

  Starting on IntelliJ IDEA.

Install a recent version of  IntelliJ IDEA kotlin is bounded with IntelliJ IDEA starting from version 15 you can download the community edition from this link

 

 After installing  we need to open it and then in the file menu on the left bar select new -> project->we select the java sdk option kotlin works with java jdk 1.6  Also select the kotlin(java) check box as given above and then click next 

          
   

after that give a name for your project in the options as above i have created my project name as nadeemnew

 and now we have our project created with the folder structure as given above.

Now we need to create kotlin file under the src folder any name can be given i have named here nads select the src file right click select file and then select kotlin File/Class you can see it on the above image once we have the file created we need to type the main routine which is the entry point to the kotlin application In our IDE IntelliJ IDEA offers us a template to do this quickly 

just type main in the file we created and press tab there will be a function created as below 

and here we have added a println () statement which will print the statement in the braces

fun main(args: Array<String>) { println("Hello, World!") }
okay now after typing this code we need to run the application for that we can
select the run menu on the right pane of the menu bar there select the kotlin file
to run and then press the run or there will be run symbol in the main function 
left part click there and select the kotlin file if there is no problem the
application will work well and the result will be shown in the run tool window 
as given below
 
 
 now we have our first kotlin programme running see you in the next post there we 
will learn about basic syntax of kotlin  
 
           
 
 

Thats all for this post friends hope you like this post please share my blog and comment your suggestions so that i can improve this post for an easy learning of kotlin language.And if you wish you to get latest updates on this lesson then follow by email id  or follow me

No comments:

Post a Comment