All you need to know to get started with Java

April 5, 2022 0 Comments

Java is usually the first programming language that starts with most coders because it is easy to understand and runs cross-platform. In fact Java is often referred to as ‘lingua franca’ or the common language because so many developers are using it. Since almost everyone has used it in the past or is still doing so, solving problems cannot be easy – you are guaranteed to find someone who can help. The developers of Java originally wanted to name it Oak. But the name was already trademarked by Oak Technologies, so a series of brainstorming sessions were held to come up with a dynamic and fun name that would appeal to the next generation of coders. The team came up with three options that were legally acceptable – Java, DNA and Silk. Finally Java was chosen.

Write Once Run Anywhere (WORA)

The word WORA is used to describe Java which means write anywhere to run once. Once compiled, the non-stop JVM or Java virtual machine takes the byte code compiled and converts it into machine code that can be understood by the machine. So once compiled, your Java code can be run on any system, regardless of the underlying hardware or operating system. This portability feature makes Java the most attractive to programmers. Java acquires many of its syntax and features from C ++ but adds a lot of its own capabilities in the process.

Java is used to develop enterprise-wide applications, web applications, games and now mobile applications. In today’s mobile age Java is more relevant than ever. Android programming is basically done using Java. The whole Oracle v. Google case was actually because Oracle claimed that Google violated their Java API to develop the Android operating system and API.



James Gosling

Java version

There are four versions of Java that target different application environments. Java APIs are split as part of a version.

  • Java card for smart card
  • Java platform, micro version (ME) for environment with limited resources like mobile.
  • Java Platform, Standard Version for Workstation Environment (SE)
  • Java Platform, Enterprise Edition (EE) for large distributed enterprises or Internet environments.

There are also several lightweight languages ​​built on Java that can use JVM such as Groovy (a dynamic language with features of Python, Perl, Smalltalk and Ruby), Clojure, Jython (a Python interpreter), JRuby (a Ruby interpreter)). Each was built for their own dedicated purpose.

Java and Android

The Android operating system is built on the Linux kernel written in C. Android applications are written in Java. Android does not use Java Virtual Machine or JVM. It has its own virtual machine called Dalvik Virtual Machine which converts all bytes of code. The Java code is compiled into proprietary byte code and executed on the Dalvik virtual machine. Dalvik VM has a register based architecture which is different from Java VM which uses stack based architecture.

Oracle’s Java timeline

If you want to know the history of Java, Oracle’s Java timeline makes it interesting to read. It shows how Java has evolved and become an integral part of our lives.

Oh world

The first line of code written in any programming language is a print statement of ‘Hello World’.
So here it is Java.

class FirstProgram{

public static void main(String args[]){

System.out.
println(“Hello World!”);

}

}

Object Oriented Concept

Executes a sequence of conventional or systematic programming commands that input, output, and manipulate data. Allows repeated calls to commands from different parts of the function and subroutine program. Object Oriented Programming consists of data and functions called methods which are integrated into the ‘Object’ software called ‘Class’. A class is a blueprint from which objects are made. Object Oriented Programming makes it easy for programmers to create and order code. Take a racing game for example. Here ‘car’ will be defined as an object with data members like make, model and speed. The car will also have acceleration, left turn and right turn.

Class Car {

String make;

String model;

double speed;


public void accelerate(){

//code to accelerate 

}


public void turnLeft(){

//code to turn left

}

public void turnRight(){

//code to turn right

}

}

There may be two cars or one hundred. Each would be called an example of that object. Individual instances can be modified without affecting other parts of the program.

The original OOP concept



I see a lawyer coming!

Data hiding / abstraction
When data is grouped into classes / objects, programmers have the option to personalize the data for a specific class. So the outside world will only see what is needed to use the class without accessing unnecessary sometimes personal information.

Data encapsulation
Wrapping logically related data and functions that work on this data into bundles is called class.

Package
Containers bundled together for logically related classes and interfaces.

Inheritance
When a class can be based on another class, or that implementation can be reused. It can also add its own features to that implementation. In our example above the class car may inherit some features from other classes (called ‘super class’ or ‘base class’) ‘vehicles’.

Polymorphism
Polymorphism is the ability of a system in Java to be able to do different things depending on the object it is working on. For example, in our car class a system called accelerate () may have different implementations depending on the individual car object or the parameters given in it.

Java memory management

One of the best achievements of Java language is its memory management. Made in Java Garbage Collection. Developers can create objects without having to worry about explicit memory allocation and de-allocating.
Garbage collector automatically restores memory that it does not use. This eliminates memory leaks and other memory related problems. Garbage collection maintains the integrity of the program and is an important part of Java’s security strategy. It also stops hip fragmentation which occurs when the memory is manually de-allocated and clears a lot of uninterrupted space between them.

Educational tools
The tools available for learning and programming in Java are great. Not to mention free. Sophisticated Integrated Development Environment (IDEs) such as NetBeans and Eclipse as well as Web Server (TomCat), Application Server (Glassfish, JBoss).

Software
Oracle Docs has identified a set of extremely useful tools for learning languages ​​like Java and Java, depending on both age and experience. Whether you are an experienced programmer or a complete novice, there is something for you. They have a simple interface for you to get started, whether you are 5 years old or 80 years old.

Scratch: A simple programming interface with drag and drop features. This tool is designed for 5-15 year olds who have no programming experience.

Greenfoot: A 2D visual software with built-in code editor to create games and simulations. Again, this is for beginners who have no prior programming experience, but are over the age of 13.

Alice: A 3D educational tool for animation with a drag and drop interface. No programming experience required. There is no age limit.

In the blues: This is a slightly more sophisticated tool where users are expected to write their own code. It is not an irresistible IDE like Eclipse or NetBeans and provides bare basics for running a Java program. Using BlueJ requires little coding experience. High school kids usually start with this.

NetBeans / Eclipse: These are full-featured Java integrated development environments used in educational as well as professional environments.



How legacy works

Documentation and website

Oracle Online Java Documentation has everything you need to get started. All function calls and classes are well explained.

Tutorial

Mikeyong
MIT OpenCourseware has Java tutorials
Coursera has courses, not just Java courses, that will teach you the basics of design pattern / policy and algorithm development.

Problem solving

Probably the best quorum for doubts about the code and questions about how to deal with a specific obstacle stackoverflow. They even have a section for code review where senior colleagues will review your written code and give you feedback here.

Visit here for tutorials on the other 15 hot programming languages.

Leave a Reply

Your email address will not be published.