Skip to main content

Getting Started with IntelliJ IDEA - Kotlin

It’s easy to get started with Kotlin using the Kotlin plugin integrated in IntelliJ IDEA. Benefit from code highlighting, code completion, refactoring, debugging, and other features available for Kotlin.

If you want to start from scratch, you can create a basic Kotlin application. Once you’ve created the application, you can dive deeper into Kotlin syntax.

What is Kotlin?

Kotlin is an expressive and concise programming language that reduces common errors. Easily integrates into existing apps and is 100% interoperable with the Java language. Multiplatform. Code safely. Online courses. Easy to learn. Big community. Write less code.

IDEs?

IntelliJ IDEA IDE (Download, Install):

IntelliJ has a lot of versatility and stability. Kotlin was initially developed by the JetBrains team, which means there’s an extra level of compatibility between the two. Kotlin even has IntelliJ-specific tutorials and getting started guides.

Kotlin Playground (Online, Web Brower base):

You can try/ learn kotlin online without downloading or installing any ide on your computer.

Android Studio (Download, Install):

Android Studio provides the developers with fast tools for building apps on every type of Android device. Android Studio has had full support for Kotlin.

or

Text Editor (Download, Install)

Sublime Text

Getting Started with IntelliJ IDEA

Create an application

Once you've installed IntelliJ IDEA, it's time to create your first Kotlin application.

  1. In IntelliJ IDEA, select File | New | Project.
  2. In the panel on the left, select Kotlin.
  3. Enter a project name, select Console Application as the project template, and click Next.

    k01

    By default, your project will use the Gradle build system with Kotlin DSL.

  4. Go through and accept the default configuration, then click Finish.

    k02

    Your project will open. By default, you see the file build.gradle.kts, which is the build script created by the Project Wizard based on your configuration. It includes the kotlin("jvm") plugin and dependencies required for your console application.

  5. Open the main.kt file in src/main/kotlin.
    The src directory contains Kotlin source files and resources. The main.kt file contains sample code that will print Hello World!.


  6. Modify the code so that it requests your name and says Hello to you specifically, and not to the whole world.

    • Introduce a local variable name with the keyword val. It will get its value from an input where you will enter your name – readLine().
    • Use a string template by adding a dollar sign $ before this variable name directly in the text output like this – $name.


Run the application

Now the application is ready to run. The easiest way to do this is to click the green Run icon in the gutter and select Run 'MainKt'.

k03

You can see the result in the Run tool window.

k04

Enter your name and accept the greetings from your application!

k05

Congratulations! You have just run your first Kotlin application.

Source

Comments

Popular posts from this blog

How to set Profile Attribute in Siebel Workflow

For setting the Profile Attribute in Siebel Workflow, follow below steps: Add Business Service box in workflow. Open Business Service properties. Set  SessionAccessService in Business Service Name. Set  SetProfileAttr in Method Name. Then click on Business Service and set Input Arguments as below: Against Name argument you will add your profile attribute name and against Value argument you will add value for the new profile attribute, it could be from Process Property or Literal.

How to call Popup Applet through Server Script in Siebel

Background: Based on the requirements you need to show data or reports on a popup applet. You can invoke popup applet using workflow (below business service will be used in business service step), applet server script or browser script and using vanilla method and setting field user properties. Procedure: Below is the script for calling popup applet through server script: if (MethodName == "MethodName") { var oServiceAF = TheApplication().GetService("SLM Save List Service"); var inputPropAF = TheApplication().NewPropertySet(); var outputPropAF = TheApplication().NewPropertySet(); inputPropAF.SetProperty("Applet Name","ABC Popup Applet"); inputPropAF.SetProperty("Applet Mode","6"); inputPropAF.SetProperty("Applet Height", "700"); inputPropAF.SetProperty("Applet Width", "700"); oServiceAF.InvokeMethod("LoadPopupApplet", inputPropAF, outputPropAF) return (CancelOperati...

How to create and publish Inbound Web Service in Siebel based on Workflow

Inbound Web Services: The Inbound Web Service allows an external system to call a Siebel published Web Service. You can publish a business service or a business process as a Web Service and generate a Web Service Definition Language (WSDL) file that an external system can import. The Inbound Web Services can only be published from Siebel C using SOAP-RPC binding. Source: Oracle Docs What Is The Difference Between Web Services and APIs? An API is an interface that allows you to build on the data and functionality of another application, while a web service is a network-based resource that fulfills a specific task. Yes, there’s overlap between the two: all web services are APIs, but not all APIs are web services. Both web services and APIs are — at their core — very useful and very much used today. However, it’s the web services associated with SOAP and/or Service Oriented Architecture which are falling out of favor. Source: NordicApis Process: Prepare the workflow which will serve as Si...