The document discusses a seminar on Kotlin, highlighting its features, history, and comparisons with Java. Kotlin is a statically-typed programming language aimed at JVM targets, known for its null safety, full Java interoperability, and ability to compile to JavaScript. The presentation also covers basic syntax and differences between Kotlin and Java, emphasizing Kotlin's advantages in reducing code complexity.
This section introduces Kotlin as a statically-typed language developed by JetBrains, aiming for JVM and JavaScript compatibility.
This slide outlines the history of Kotlin, its initial development starting in 2011, the first release in 2016, and its recognition as a first-class language for Android by Google in 2017.
Highlights Kotlin’s features including open-source nature, Java interoperability, JVM/JS compilation, null safety, and focus on concise code.
Introduces basic Kotlin syntax, showcasing package specifications and variable definitions with examples.
These slides compare Kotlin and Java, highlighting key syntax differences including semicolons, object creation, checked exceptions, type inference, and concise code structure.
This slide explains Kotlin's data classes, which simplify data handling compared to Java by reducing boilerplate code.
This final slide invites any queries, encouraging interaction from the audience.
Introduction
• Kotlin isa statically-typed programming language
• It is jvm targeted language
• It support object oriented programing and
functional programing feature
• It can also can be compiled to JavaScript source
code
• Its primary development is from a team of
JetBrains
5.
History…
In July2011 JetBrains Start Project Kotlin, a new
language for the JVM, which had been under
development for a year.
JetBrains hopes that the new language will
drive IntelliJ IDEA sales.
Kotlin v1.0 was released on February 15, 2016.
In may 2017 Google I/O Declared as the First
class language for android development
6.
Features of Kotlinprogramming language
• Kotlin is open source.
• Full Java Interoperability.
• Kotlin compiles to JVM bytecode or JS.
• Null Safety in Kotlin.
• Kotlin wants you to write less code.
• Higher order function
7.
Basic syntax
PACKAGE:-
Package specification should we at the top of the application similar to java
Example-
package Bu.Iet;
import java.util;//import util package
Defining local variables
Example-
var a:Int=12//immediate assignment
var a=123;//type inference
8.
Difference Between Kotlinand java
No Semicolons
// Java System.out.println("Hello world!);
// Kotlin println("Hello world!")
No Checked Exceptions
•// Java code often looks like this
• Try
• {
• Connection con=DriverManager.getConnection()//this sta throw an
checked exception
• }
catch(SqlException r)
• {
• }
• // Kotlin has no checked exception
11.
Type Inference
// Java
Int a = 1;
String b = “sachin";
Program p;
// Kotlin
var a = 1
var b = “sachin"
var p: Program
12.
Size of Code
•// Java
• class Person
• {
• String firstName;
Person(String firstName) { this.firstName = firstName;
• }
• }
• // Kotlin class with primary constructor
• class Person(firstName: String)
13.
Data Classes
• //Java
• To hold the data we must make simple classes with getter and setter method
in data
• // Kotlin
• In kotlin they provide the concept od data classes to hold the data
• To define an data class in kotlin we use the keyword data before the class
keyword
• data class Student(val name: String,val age: int)