Enter
First tech post!
Some background: I took to learning web development after securing a spot at a coding fellowship in the end of 2020. It's been one heck of a journey since then.
I'm taking the reigns to learn Java. Why learn Java after JavaScript? Because I want to learn how to build and maintain mobile applications. So I'm happy to document this journey here. Some of my colleagues recommended Kotlin as the next stepping stone instead of Java, but I decided to learn that at a later time since foundational concepts of programming don't change.
Java to JavaScript
Stranger in a Strange World
The Java ecosystem I've entered is very different from the comfy world of web development I normally work with in JavaScript. But I guess that's to be expected when learning a completely new language. Perhaps each major language has its own personality and niche, and it's cool to explore a brand new one.
So with learning Java:
I've had my first brush of what it means to compile code and execute it after. Java compiles the source code into bytecode, which then the JVM (Java Virtual Machine) then executes the bytecode making it available to use on many devices.
Java is strongly object oriented programming, because we can't develop a program without making use of classes.
I learned there are a handful of primitive data types Java supports. They are:
byte
,short
,int
,long
,float
,double
,char
,String
,boolean
. Each varying in degree of the size they take up in memory.In Java, declaring a variable also means specifying what data type it is, which in JavaScript you don't have to. For instance, in Java if we declare
String message;
, initializing this variable withmessage = 123
would be illegal because the value is an integer. Butmessage = "123";
would be legal since it's a string, correlating to its data type.Learned a little about packages in Java. Still a bit unsure about this topic, but from what I understood so far, importing packages are a way of utilizing various classes for specific procedures in your application. I'm thinking of it as a folder that holds many related files that could be useful. An example I used when coding was the Scanner package, which helps parse input from users on the terminal.
In Java's arithmetic operations, division is a bit peculiar because dividing integers gives us whole numbers, even if there is a remainder. So the solution would be to use floating-point numbers. For instance:
There's also a handful of other small things I learned that I'll add if I remember them.
Long Way to Go!
Still got a long way to go. But as of now, I'm enjoying the process! 😎
In the near future, I plan on doing some LeetCode problems with Java and learn about making an application on Android.
Top comments (0)