java – Teknonauts https://teknonauts.com Stay Tuned With Technology Sun, 18 Apr 2021 04:38:41 +0000 en-US hourly 1 https://wordpress.org/?v=5.7.5 https://teknonauts.com/wp-content/uploads/2021/01/cropped-teknonauts_favicon_original-1.png java – Teknonauts https://teknonauts.com 32 32 #16 Planning to Learn Java in 2021 https://teknonauts.com/java-2021/ https://teknonauts.com/java-2021/#respond Wed, 14 Apr 2021 06:47:56 +0000 https://teknonauts.com/?p=3795

How you should plan to learn JAVA this year

if you are looking to learn java this year and thinking from where to start. Which technologies you should have more focus then this is the blog for you.

Doesn’t matter if you are starter, middle-level learner or pro java player at work. This blog explores the basics you need to know.

Learning a programming language is a technological process that requires serious preparation. Otherwise you will get bored and stuck in the learning process itself.

java

Starter : Core Java

First things first. No surprises, Core Java is a must for every Java Developer in every year of the language existence. That’s good news, because even IT people need stability.

Well, Core Java is like the main rules of any language. To become a programmer you definitely need to learn to code in a general sense. Core Java contains the syntax, basic constructions and concepts of the language. Here they are.

Basic Syntax

Learning syntax its like learning alphabets in your primary school. Its better to learn through practice from very first learning steps.

Main Java Syntax topics:

  • What is an Object
  • What is a Class
  • What is a variable
  • What is a method
  • System.out.println() method
  • Primitive types (int, double, boolean, char, etc)
  • String
  • Basic arithmetic and logical operators
  • Branches: if-else statement
  • Loop statements (for, while)
  • Arrays

Knowing Java syntax well is the same as knowing a foreign language at the A1 level.

OOP concepts

Modern versions of the language have supported functional programming, however, Java programming is more or less all about Object Oriented Programming (OOP).

That’s why a deep understanding of OOP is extremely important for everyone who wants to be a Java developer. This topic is not extremely tough. However, it takes a lot of practice to get a feel for all the concepts of OOP.

When studying OOP, you first need to understand what an object is, how attributes differ from behavior, and how they should be expressed in Java. The ideas of inheritance, encapsulation, and polymorphism need to be understood so deeply that you can learn how to correctly build the hierarchy of objects in your programs.

While studying OOP, I recommend solving a lot of problems and reading a lot. Take a look at the code of Java classes, learn how they relate to each other. Don’t be lazy, read books that get to the point

Collection Framework

The Collection in Java is a framework that provides an architecture to store and manipulate the group of objects.

Java Collections can achieve all the operations that you perform on a data such as searching, sorting, insertion, manipulation, and deletion.

Java Collection means a single unit of objects. Java Collection framework provides many interfaces (Set, List, Queue, Deque) and classes (Array list, Vector, Linked list, Priority Queue, HashSet, Linked HashSet, Tree Set).

The Collection framework represents a unified architecture for storing and manipulating a group of objects. It has:

  1. Interfaces and its implementations, i.e., classes
  2. Algorithm

You need to understand when to use Collection framework in which use cases.

Java Object Class

The Object class is the parent class of all the classes in java by default. In other words, it is the topmost class of java.

The Object class is beneficial if you want to refer any object whose type you don’t know. Notice that parent class reference variable can refer the child class object, know as upcasting.

Let’s take an example, there is getObject() method that returns an object but it can be of any type like Employee, Student etc, we can use Object class reference to refer that object. For example:

it is important to get the Object class realization and its methods. It helps a lot to understand the essence of the language.

Object obj=getObject();//we don't know what object will be returned from this method 
Exceptions

An exception (or exceptional event) is a problem that arises during the execution of a program. When an Exception occurs the normal flow of the program is disrupted and the program/Application terminates abnormally, which is not recommended, therefore, these exceptions are to be handled.

An exception can occur for many different reasons. Following are some scenarios where an exception occurs.

  • A user has entered an invalid data.
  • A file that needs to be opened cannot be found.
  • A network connection has been lost in the middle of communications or the JVM has run out of memory.

Example:

import java.io.File;
import java.io.FileReader;

public class FilenotFound_Demo {

   public static void main(String args[]) {		
      File file = new File("E://file.txt");
      FileReader fr = new FileReader(file); 
   }
}

If you try to compile the above program, you will get the following exceptions.

Output

C:\>javac FilenotFound_Demo.java
FilenotFound_Demo.java:8: error: unreported exception FileNotFoundException; must be caught or declared to be thrown
      FileReader fr = new FileReader(file);
                      ^
1 error

Note − Since the methods read() and close() of FileReader class throws IOException, you can observe that the compiler notifies to handle IOException, along with FileNotFoundException.

Generics

Generics (generic types and methods) allow us to get away from rigidly defining the types to use. The topic, although unusual at first, is not very complicated. The faster you learn them, the better your code will be.

Multithreading

Java is a multi-threaded programming language which means we can develop multi-threaded program using Java. A multi-threaded program contains two or more parts that can run concurrently and each part can handle a different task at the same time making optimal use of the available resources specially when your computer has multiple CPUs.

By definition, multitasking is when multiple processes share common processing resources such as a CPU. Multi-threading extends the idea of multitasking into applications where you can subdivide specific operations within a single application into individual threads. Each of the threads can run in parallel. The OS divides processing time not only among different applications, but also among each thread within an application.

Multi-threading enables you to write in a way where multiple activities can proceed concurrently in the same program.

Life Cycle of a Thread

A thread goes through various stages in its life cycle. For example, a thread is born, started, runs, and then dies. The following diagram shows the complete life cycle of a thread.

Middle-level Java Programmer

New Java features

Well, nobody expects that a Java beginner should know the features of the newest Java versions such as Sealed Classes, Text blocks, Records, or Hidden Classes. However, I highly recommend trying to learn some of them or at least read about them since you learned most of the Core Java topics listed above. Recently, the JDK has been updated semi-annually, in March and September. JDK 16 appeared on March 16.

So, go to the OpenJDK website, which lists all the JDK Enhancement Proposal (JEP’s) from new versions. Read on, experiment with settings, it’s really useful! Even if you are a complete beginner, start to read about them to be in on trends.

Java beginners and professionals in 2021 are expected to know:

  • Lambda Expressions
  • Java Functional Interfaces
  • Stream API
  • Method References
Unit testing

So make a present for yourself and your future employer by learning the JUnit Framework as well as the powerful Mockito library. More experienced developers also often test their code using these libraries. So this knowledge will be useful to absolutely all Java Developers.

Data Structures and Algorithms

Data structures need to be learned, but is it worth doing at the abstraction level? In principle, it is possible, especially if you have already had time to work a little with some of their implementations in practice. In addition, very often the theoretical foundations of data structures (how and how efficiently insertion, deletion, and search are implemented in them) are demanded in interviews.

Java Ecosystem

When you start learning Java, often the first thing you are told about is bytecode, Java Virtual Machine, JRE, and JDK. That is how Java essentially works. However, at the first stage, this knowledge is rather a curious abstraction. I highly recommend returning to this topic at different stages of your learning, and even during work.

Understanding how the Java Ecosystem works adds a lot to your programming skill. For example, studying the work of the Garbage Collector . In general, it is very important for a developer to understand how the JVM allocates memory, what is Dynamic linking, runtime interpreter, and so on.

Design and Architectural Patterns

In 2021, trained professionals are expected to have knowledge of design patterns and the ability to apply them in practice. It is both simple and difficult at the same time.

A design patterns are well-proved solution for solving the specific problem/task.

Now, a question will be arising in your mind what kind of specific problem? Let me explain by taking an example.

Problem Given:
Suppose you want to create a class for which only a single instance (or object) should be created and that single object can be used by all other classes.

Solution:
Singleton design pattern is the best solution of above specific problem. So, every design pattern has some specification or set of rules for solving the problems. What are those specifications, you will see later in the types of design patterns.

Working with data

There are two major classes of databases: SQL (relative) and NoSQL (non-relative). Relative databases are more popular so the first step is to learn them.

  1. First, you can read about Databases and their structure. Download one of them (for example, PostgreSQL, which is free and open source), project one or two.
    1. For the first steps you can learn to interact with the SQL database.
    2. b. and learn to perform the very basic CRUD (standing for Create, Read, Update, Delete) SQL commands on the data of your first applications. There is JDBC driver, a platform-independent standard for interaction between Java applications and databases. JDBC is implemented as a java.sql package included with Java SE (standard edition). So first you can use it directly.
    3. c. Later when you feel more confident, you will soon be able to further adapt the usage of Object Relational Mapping (ORM) systems: special software libraries that allow you to work with data in a more natural and human-readable format, without writing SQL queries explicitly. Undoubtedly one of the most popular and widely used Java ORMs is Hibernate.
  2. If you have time you can try MongoDB. It could be a pretty interesting experience.

Pro Java Programmer

The technologies I mentioned in this paragraph are quite difficult to learn on your own. They are quite complex and are best learned in a team setting, in real projects. However, it is possible.

When people talk about Enterprise technologies related to Java, they usually mean two main stacks, Spring Framework and Jakarta Enterprise Edition (formerly Java Enterprise Edition, JavaEE).

They do similar things, but not quite. You can think of Spring as a set of frameworks, while pure Jakarta is a set of specifications and standards.

Spring is ideal for developing small GUI front-end applications or microservices architecture. However, leaving the dependency on application servers negatively affected the scalability of Spring applications.

Java EE is well suited for implementing a scalable, monolithic clustered application.

In the labor market, at the moment, developers who are familiar with the Spring Framework are more in demand. Historically, in the days when Java EE was overcomplicated, Spring “gained a client base.”

So it is more logical in 2021 to make efforts to learn Spring. Nevertheless, it would be better to get acquainted (at least superficially) with both platforms. Write a small home project in both Java EE and Spring. Then delve into the framework that is required at work.

Spring Framework is a huge ecosystem for building backends. The most important parts of Spring to learn:

  • Core Spring components, such as Dependency Injection (DI), Inversion of Control (IoC), and Spring MVC in general.
  • Spring Boot
  • Spring Security
  • Spring Data JPA
  • Spring AOP

Useful Components

Some employers expect future programmers to know a number of tools and libraries that help in their work.

  • Servlets, components to extend the capabilities of a server.
  • Log4j, one of the most useful libraries for logging messages.
  • Jackson/JSON. JSON (JavaScript Object Notation) is an open standard file format and data interchange format. Jackson is a high-performance JSON processor for Java.
  • Java API for RESTful Web Services.

Conclusions

It a long list but with proper planning and dedication you can easily learn Java basics and java advanced concepts.

Explore more at Teknonauts.com

]]>
https://teknonauts.com/java-2021/feed/ 0