Berkay Çubuk

Introduction to Java

Tue Nov 17 2020

What is Java?

Java is not only programming language, Java is a platform with multiple sub items:

  • Programming language
  • Infrastructure for Java apps
  • Libraries and tools for different areas like desktop, mobile, watch, web…

Java have 3 different connected platforms:

Java Standart Edition (JSE): Core for basic Java apps.

Java Enterprise Edition (JEE): For big, distributed commercial Java apps.

Java Micro Edition (JME): For small devices like mobile, watch…

To use these platforms, first you have to learn JSE, because other platforms are based on JSE.

Java is platform independent

Java is platform independent so you can develop your java application in your current device and use it in any other device.

Java has “Write once, run anywhere” philosophy.

For example I can create calculator application on my windows machine and then I can use it on my linux machine. That’s super cool 🤯

But how it’s possible? It’s simple because java uses Java Virtual Machine (JVM). First we writing our java application and compiling it with java compiler. After compiling it’s produce class files with .class extension. Class files are contain platform independent byte-code binary data that can be interpreted by any JVM. But that means we have JVM’s that designed for each platform. This JVM thing lowers our speed but that’s the price for independence (Talking about miliseconds 😛).

Also we have JDK and JRE.

JDK (Java Development Kit) is what we’re using to develop java applications. JRE (Java Runtime Enviorement) is what we need to run java applications.

Let’s start programming

Before start programming you have to setup your enviorement. It’s different for each operating system so you can take quick look on the web.

Start with something well known:

public class FirstApp { // also your filename => FirstApp.java

  public static void main(String[] args) {  // standart structure for main function
    // do what you want

    System.out.println("Hello World!");  // print string to the console

  }

}

Output will be like:

> Hello World!

OK, looks cool but how did I compile and run that 🤔 If you want to learn the core concept, open your terminal and run javac FirstApp.java. This command will create FirstApp.class file. To run the program just type java FirstApp. That’s how we compile and run java application, but in reality that’s not efficent. To make it better we use IDE’s. There are good alternatives such as Eclipse, Intellij IDEA, Netbeans

If you want to learn more about java I’m leaving some links:

Subscribe to my newsletter

I share weekly newsletter about my ideas and interesting information I found.

Let's make your dream project real!

Book a call with me and maybe we can combine our forces to make your project a reality.

Book a call now!