KotlinCS 124 LogoJava

Choose Your Language

You may complete CS 124 using either the Java or Kotlin programming language. Let’s discuss this choice and the tradeoffs involved.

Language Option
Language Option

You are required to choose either Kotlin or Java as your primary programming language before starting CS 124. All materials and assessments will be available to complete in either language. We discuss the tradeoffs below.

Note that, while we ask that you make a choice before starting, you may change your mind at any point. You may also complete all of the homework and the project in both Kotlin and Java. So, even if you are already familiar with Java and choose it as your primary language, you may want to complete some of the Kotlin homework as a way to learn something new.

However, once you begin a quiz in a language you must complete that quiz in that language, and will not receive credit for the same quiz taken in the other language. This is because the Kotlin and Java quizzes are similar, and seeing one would give you an advantage on the other.

Kotlin
Kotlin

We began offering Kotlin as a language option for CS 124 in Fall 2021, and several hundred students complete the course in Kotlin that semester. Students who completed the course in Kotlin did a bit better than those that chose Java, but this was probably due to more experienced students choosing Kotlin over Java.

Kotlin is a younger language than Java, first appearing in 2011. Kotlin and Java are both built on top of some of the same underlying technologies, and Kotlin interoperates fully with existing Java code. However, the syntax of the two languages is completely different, and Kotlin provides better support for certain styles of programming that Java does. In May 2019, Google announced that Kotlin is now its preferred language for Android app development, which we will do a bit of later in the semester.

Java
Java

Java has been used by CS 124—and, previously CS 125—at Illinois for many years.

Java is an older language than Kotlin, first appearing in 1996. Since then Java has become one of the most widely-used programming languages on Earth. Java was the first language chosen by Google for Android app development, and is still in widespread use for this purpose, even after Google announced in 2019 that Kotlin would replace Java as the preferred Android development language moving forward.

How to Choose
How to Choose

First and foremost: There is no wrong decision! Kotlin and Java are both established programming languages with solid industry backing and well-defined uses. Neither is going anywhere anytime soon.

In addition, learning computer science is only partly about learning how to program. CS 124 will teach you to think like a computer scientist, and you can learn that equally well in Kotlin, Java, and any and every other programming language you learn next.

That said, we’re offering CS 124 in two languages because there is a tradeoff here. So let’s discuss some reasons that you might choose or not choose Kotlin or Java.

You Might Choose Kotlin Because…
You Might Choose Kotlin Because…

  1. Kotlin is a newer language that addresses many recognized weaknesses with Java and reflects several additional decades of improvement in programming language design
  2. Knowing Kotlin will help you stand out when looking for internships and jobs, since it’s a newer language with a smaller developer community
  3. You already know a bit of Java from a previous course and would like to challenge yourself with something new

You Might Choose Java Because…
You Might Choose Java Because…

  1. Java is one of the most widely-used programming languages, and there is a lot existing code already written in Java
  2. Many employers already interview in Java, while fewer have yet added Kotlin
  3. You already know a bit of Java from a previous course and would like to build on your current understanding

Ready to Pick?
Ready to Pick?

Whatever you choose, you will learn to program in CS 124, and we’ll be there for you all the way!

Frequently Asked Questions
Frequently Asked Questions

Still confused about which to pick? Perhaps these questions will help.

Which is better, Kotlin or Java?
Which is better, Kotlin or Java?

Neither, which is why we’re offering both! Java and Kotlin are different languages that present different tradeoffs. Kotlin has arguably better syntax, but it’s newer and in less widespread use. Java is extremely well-established, but has begun to lose its dominant position—for example, as the primary language for Android, replaced by Kotlin.

There’s no right answer. But there’s also no wrong answer! Regardless of whether you choose Kotlin or Java, you will learn to program in CS 124. And if you start with Java/Kotlin, you’ll be able learn Kotlin/Java more easily once you’re ready.

Why isn’t Python an option?
Why isn’t Python an option?

Python has some significant weaknesses for teaching introductory computer science. Specifically, Python is dynamically typed, meaning that data types can change at runtime, which limits the types of mistakes that can be caught before your code is run. If the previous sentences didn’t make any sense yet, that’s OK. But trust that we’ve thought about this quite a bit and believe that both Java and Kotlin are better choices than Python for teaching beginners. Feel free to ask on the forum if you’d like a longer explanation.

However, if you know a bit of Python and like it, you might want to consider choosing Kotlin. Kotlin’s syntax is a bit more similar to Python, at least when you are getting started, even if there are significant and important differences between the two languages lurking beneath the surface.

(FWIW, we are starting to work on adding support for teaching typed Python in CS 124, potentially as an add-on option starting Fall 2024.)

Will I do better if I take CS 124 in Kotlin or Java?
Will I do better if I take CS 124 in Kotlin or Java?

The Kotlin and Java versions of CS 124 will teach the same concepts and assign the same assessments. Neither version of the course is harder or easier than the other. And, regardless of which language you pick, the CS 124 course staff will do everything they can to help you succeed.

Do other CS courses at Illinois use Java or Kotlin?
Do other CS courses at Illinois use Java or Kotlin?

Other than CS 124, no required CS courses at Illinois use either Java or Kotlin. CS 128, which immediately follows CS 124, starts and ends in C++, as does CS 225. CS 241 uses C, and a few of the 300-level required courses use Python. CS 421 seems to use either Haskell or OCaml, depending on who is teaching it.

There are a few upper-level software engineering courses that use Java, but by that point you’ll be so experienced that picking up a new language won’t be too much of a challenge.

(Insert your question here…)?
(Insert your question here…)?

Ask us on the forum! The choice of Kotlin or Java is new, and we’re happy to talk through the decision with you.

Language Feature Comparison
Language Feature Comparison

If you already have some programming experience, you may find the following walkthroughs interesting. However, prior programming experience is not required to enroll or succeed in CS 124! (In Spring 2021 the grade gap between students with and without prior experience was only 1 percentage point!)

Java Features
Java Features

First, let’s look at some basic Java features.

System.out.println("Hello, Java!");

Kotlin Features
Kotlin Features

Next we’ll look at a few of the differences and nice things about Kotlin.

println("Hello, Kotlin!")