Hello World with Java

Reading Time: 5 minutes

Sunset

Here We Go!

Thanks for joining the Codeogre! Let’s take a sip from our cocktails and enjoy the very first post! Since Java is the most powerful weapon of mine (I imagine Java as a big, bulky two-handed axe -> ), I will talk about Java a little bit to break the ice between us.

Java, the Island?

What, No!? Wait a second, why would you…

Yeah, now you know there is an island named Java in Indonesia. There are lots of places named Java. Actually, there are so many things named Java, if you are a curious individual, you can check them over here.

But! There is one thing named Java… Strong, solid but also delicate, generally friendly but sometimes difficult to understand like the girlfriends which we don’t have since we are introvert nerds (Don’t mind my shameful jokes, it also cringes me). Every coder knows about Java besides the ones passed away before the release (R.I.P Ada Lovelace – First Programmer).

What is Java the Language, then?

javaupdate

Java is a programming language and computing platform first released by Sun Microsystems in 1995. There are lots of applications and websites that will not work unless you have Java installed, and more are created every day. Java is fast, secure, and reliable. From laptops to datacenters, game consoles to scientific supercomputers, cell phones to the Internet, Java is everywhere!

says the very original source of Java. Let me note that Sun Microsystems is owned by Oracle Corporation now. Their slogan is: “Write once, run anywhere” The reason behind this slogan is that the compiled Java code (byte code) can run on platforms that support Java without any recompilation. After Javac (Java Compiler) compiles the source code into byte code, JVM interprets this byte code into Native Machine Code, so the code becomes independent of the platform it has written on. JVM is a virtual machine which deserves its own post. A huge thing. Just know what it does for now. (There is also a thing called JIT (Just in Time Compiler) which optimizes the performance after the application has started. It is pretty advanced and I’ll talk about it in later posts.)

 

howdoesjvmwork
JVM Diagram (Source: Wikipedia)

Java is the most popular language over the world (TIOBE Index) coming after C. I’ll give you some reasons why. First of all, James Gosling (Creator of Java) described the language as “Blue Collar” language. It aims for being easy to develop and easy to pick-up other’s codes (even the owner’s) later and understand what they suppose to do. In addition to this; the syntax resembles C and C++ languages and easily understandable, developers can get used to it pretty fast. For me, I didn’t know C when I learned Java, so being easily understandable was a big deal for me, hehe. Another reason is, Java is still fresh. Version 9 has been released in September/2017 and version 10 is going to be with us. Owners are trying to keep Java up-to-date with new concepts. Java is portable because of the JVM as we have discussed. It has its own Garbage Collector which basically frees RAM when there are unused objects. There are more advantages and also disadvantages like boiler-plate code, presence of inadequate class libraries and the dubious value of various checked exceptions; but these should be enough for now. I am going to write a post about “Advantages and Disadvantages of Java” and “Why Java?” later on.

Java also has its five primary principles:

  • It must be “simple, object-oriented, and familiar“.
  • It must be “robust and secure“.
  • It must be “architecture-neutral and portable“.
  • It must execute with “high performance“.
  • It must be “interpreted, threaded, and dynamic“.

These principles and features put together, are the reason why Java still is the #1 most popular language.

Java is created to be an alternative to C++/C at the first hand, so I’m going to walk you about Java’s most significant features through the differences with C and C++:

  • C and C++ are function oriented (procedural), but Java is object-oriented.
  • C and C++ are compiled, but Java is compiled but also interpreted.
  • C and C++’s basic programming unit is functions, Java’s is class (ADT=Abstract Data Types).
  • C and C++ use pointers, Java doesn’t use pointers.
  • C doesn’t (C++ does) support method overloading, but Java does support method overloading.

The list goes on and on. I’m not going to give details about these differences in this post, I’ll give full detail about each difference in their own posts.

Here is a classic “Hello World!” example snippet of a Java language:

Conclusion

To summarise, Java is a well-made, commonly used language which has an important position in coding field. It is being used in so many different areas such as Android, server apps at financial services industryweb applications, big data technologies, scientific applications and more.

My Opinions!

As a Java Back-End Developer Ogre myself, I strongly recommend learning Java at some point of your career. I’m not saying learn every bit of Java, but know what is Java, what’s the big deal about Java and the usage cases of it. Each language learned will give you a different perspective for coding and development. And finally:

12002825_123324411355303_7425793092101279207_n

 

 

Leave a Reply