🚀 Kotlin Type Hierarchy – āĻŦ্āϰেāχāύ-āĻĢ্āϰেāύ্āĻĄāϞি āĻŦ্āϝাāĻ–্āϝা! đŸŽ¯

 

🚀 Kotlin Type Hierarchy – āĻŦ্āϰেāχāύ-āĻĢ্āϰেāύ্āĻĄāϞি āĻŦ্āϝাāĻ–্āϝা! đŸŽ¯

🔎 Kotlin-āĻāϰ Type Hierarchy āĻ•ী?

👉 Kotlin-āĻāϰ āϏāĻŦāĻ•িāĻ›ুāχ āĻāĻ•āϧāϰāύেāϰ Type!
👉 āϏāĻŦāϚে⧟ে āĻļীāϰ্āώে āĻĨাāĻ•ে Any āĻ•্āϞাāϏ, āϝা Kotlin-āĻāϰ āϏāĻŦ āĻ•্āϞাāϏেāϰ Parent!
👉 Nothing āĻšāϞো āĻāĻ•েāĻŦাāϰে āύিāϚেāϰ āϞেāĻ­েāϞেāϰ Type, āϝা āĻ•োāύো āĻŽাāύ āϧাāϰāĻŖ āĻ•āϰāϤে āĻĒাāϰে āύা!


🛠️ Kotlin Type Hierarchy āϏ্āϟ্āϰাāĻ•āϚাāϰ:

          Any
         / |  \
        /  |   \
   String  Number  CustomClass
       |      |
      Int   Double
       |
    Nothing

đŸŽ¯ āĻŽূāϞ āĻŦিāώ⧟āĻ—ুāϞো:

āϏāĻŦāϚে⧟ে Parent Type āĻšāϞো Any
āϏāĻŦ āĻ•্āϞাāϏ Any āĻĨেāĻ•ে Inherit āĻ•āϰে
Nothing āĻšāϞো āϏāĻŦāϚে⧟ে āύিāϚেāϰ āϞেāĻ­েāϞেāϰ Type, āϝা āĻ•োāύো āĻŽাāύ āϧাāϰāĻŖ āĻ•āϰāϤে āĻĒাāϰে āύা!


đŸ”Ĩ Any – Kotlin-āĻāϰ āĻļীāϰ্āώ Type!

👉 Any āĻšāϞো Kotlin-āĻāϰ āϏāĻŦāϚে⧟ে Parent Type, āϝা Java-āĻāϰ Object-āĻāϰ āĻŽāϤো āĻ•াāϜ āĻ•āϰে!
👉 āϏāĻŦ āĻ•্āϞাāϏ Any āĻĨেāĻ•ে Inherit āĻ•āϰে!

fun printInfo(value: Any) {
    println("Value: $value")
}

fun main() {
    printInfo(10)         // Int
    printInfo("Hello")    // String
    printInfo(3.14)       // Double
}

🛠️ Output:

Value: 10
Value: Hello
Value: 3.14

āĻāĻ–াāύে printInfo() āĻĢাংāĻļāύে Any āĻĒ্āϝাāϰাāĻŽিāϟাāϰ āύেāĻ“ā§Ÿাāϰ āĻ•াāϰāĻŖে āϏāĻŦāϧāϰāύেāϰ āĻŽাāύ āĻĒাāϏ āĻ•āϰা āϏāĻŽ্āĻ­āĻŦ!


🚀 Unit – āĻĢাংāĻļāύেāϰ void āϰিāĻĒ্āϞেāϏāĻŽেāύ্āϟ!

👉 Unit āĻšāϞো void āĻāϰ āϏāĻŽāϤুāϞ্āϝ, āĻ•িāύ্āϤু āĻāϟি āĻāĻ•āϟি āϏāϤ্āϝিāĻ•াāϰেāϰ Type!
👉 āĻĢাংāĻļāύ āϝāĻĻি āĻ•োāύো āĻŽাāύ return āύা āĻ•āϰে, āϤাāĻšāϞে Unit āĻŦ্āϝāĻŦāĻšাāϰ āĻšā§Ÿ!

fun sayHello(): Unit {
    println("Hello, Kotlin!")
}

fun main() {
    sayHello() // Hello, Kotlin!
}

sayHello() āĻ•োāύো āĻŽাāύ āϰিāϟাāϰ্āύ āύা āĻ•āϰāϞেāĻ“, āĻāϟি Unit āϟাāχāĻĒেāϰ āĻĢাংāĻļāύ!


🏗️ Nothing – āĻāĻ•েāĻŦাāϰে āύিāϚেāϰ āϞেāĻ­েāϞেāϰ Type!

👉 Nothing āĻŽাāύে "āĻ•িāĻ›ুāχ āύা"!
👉 āĻāϟি āϏাāϧাāϰāĻŖāϤ āĻŦ্āϝāĻŦāĻšাāϰ āĻšā§Ÿ āϝāĻ–āύ āĻĢাংāĻļāύ āĻ•āĻ–āύো āĻļেāώ āĻšā§Ÿ āύা (āϝেāĻŽāύ: Exception āĻ›ো⧜া, Infinite Loop āχāϤ্āϝাāĻĻি)!

fun fail(message: String): Nothing {
    throw IllegalArgumentException(message)
}

fun main() {
    fail("This is an error!") // Exception āĻ›ু⧜ে āĻĻেāĻŦে!
}

āĻāĻ–াāύে fail() āĻĢাংāĻļāύ āĻ•োāύো āĻŽাāύ āϰিāϟাāϰ্āύ āĻ•āϰে āύা, āĻŦāϰং āĻāϟি āϏāϰাāϏāϰি Exception āĻ›ো⧜ে!


📌 āϏংāĻ•্āώেāĻĒে:

✔️ Any āĻšāϞো Kotlin-āĻāϰ āϏāĻŦāϚে⧟ে Parent Type, āϝেāĻ–াāύ āĻĨেāĻ•ে āϏāĻŦ āĻ•্āϞাāϏ Inherit āĻ•āϰে!
✔️ Unit āĻšāϞো void āĻāϰ āĻŦিāĻ•āϞ্āĻĒ, āϝা āĻĢাংāĻļāύেāϰ return āϟাāχāĻĒ āĻšিāϏাāĻŦে āĻŦ্āϝāĻŦāĻšাāϰ āĻšā§Ÿ!
✔️ Nothing āĻšāϞো āĻāĻ•েāĻŦাāϰে āύিāϚেāϰ āϞেāĻ­েāϞেāϰ āϟাāχāĻĒ, āϝা āĻ•āĻ–āύো āĻŽাāύ āϧাāϰāĻŖ āĻ•āϰে āύা!
✔️ Kotlin-āĻāϰ Type Hierarchy āĻ•্āϞিāύ āĻāĻŦং āĻ­াāϞো āĻĒাāϰāĻĢāϰāĻŽ্āϝাāύ্āϏ āĻĻে⧟!

đŸ”Ĩ āĻāĻ–āύ āĻĨেāĻ•ে Kotlin-āĻāϰ Type Hierarchy āĻŦুāĻে āφāϰāĻ“ āĻ­াāϞো āĻ•োāĻĄ āϞিāĻ–āϤে āĻĒাāϰāĻŦেāύ! 😎

Comments

Popular posts from this blog

AI (Artificial Intelligence) āϏāĻšāϜāĻ­াāĻŦে āĻŦোāĻাāϰ āϜāύ্āϝ āĻāĻ•āĻĻāĻŽ āĻŽāϏ্āϤিāώ্āĻ•-āĻŦাāύ্āϧāĻŦ āĻŦ্āϝাāĻ–্āϝা 🧠🤖

🧠 Regex āĻ•ী?

Kotlin-āĻ āĻ­েāϰিāϝ়েāĻŦāϞ āϘোāώāĻŖা āĻ•āϰাāϰ āĻĻুāχ āωāĻĒাāϝ়