Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions ClassesTask/ClassesTask.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/testResources" type="java-test-resource" />
</content>
<orderEntry type="jdk" jdkName="openjdk-23" jdkType="JavaSDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="KotlinJavaRuntime" level="project" />
</component>
</module>
14 changes: 14 additions & 0 deletions ClassesTask/src/Main.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
fun main() {
val name = "Kotlin"
//TIP Press <shortcut actionId="ShowIntentionActions"/> with your caret at the highlighted text
// to see how IntelliJ IDEA suggests fixing it.
println("Hello, " + name + "!")

for (i in 1..5) {
//TIP Press <shortcut actionId="Debug"/> to start debugging your code. We have set one <icon src="AllIcons.Debugger.Db_set_breakpoint"/> breakpoint
// for you, but you can always add more by pressing <shortcut actionId="ToggleLineBreakpoint"/>.
println("i = $i")
}
}
37 changes: 37 additions & 0 deletions ClassesTask/src/WithoutConstructor.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
class Book(val title: String, val author: String, val yearPublished: Int) {
fun getBookInfo(): String {
return "$title by $author ($yearPublished)"
}
}

fun main() {
val newBook = Book("To Kill a Mockingbird", "Harper Lee", 1960)
println(newBook.getBookInfo())
}


//class Book {
// var title: String = ""
// var author: String = ""
// var yearPublished: Int = 0
//}
//fun main (){
// var newBook =Book()
// newBook.title = "To kill a mockingbird"
// newBook.author = "Harper Lee"
// newBook.yearPublished = 1960
//}
//
//class Book(val title: String, val author: String, val yearPublished: Int) {
// fun printDetails() {
// println("Book Title: $title")
// println("Author: $author")
// println("Year Published: $yearPublished")
// }
//}
//
//fun main() {
// val newBook = Book("To Kill a Mockingbird", "Harper Lee", 1960)
// newBook.printDetails()
//}