Thank You for visiting at https://c2crek.blogspot.com/ !! This Site is being updated continuously So, keep visiting here, shortly you'll get best solution for your technical concerns !!

Java Basics

First Steps in Java Basics

https://www.guru99.com/java-tutorial.html

What is Java?

Java is a Class-based, Object-oriented programming language developed by Sun Microsystems in 1995 (acquired by Oracle) used for building web and desktop applications. used for developing Android Apps, create Enterprise Software, Mobile java Applications.

Java Features: Java is platform-independent. Some programs developed in one machine can be executed in another machine.

 

Components Of Java Programming Language:

JDK JRE JVM and JIT:

             JDK (Java Development Kit)

             JRE (Java Runtime Environment)

             JVM (Java Virtual Machine)

             JIT (Just-In-Time) Compiler

Java Development Kit (JDK) contains JRE along with various development tools like Java libraries, Java source compilers, Java debuggers, bundling and deployment tools. Just In Time compiler (JIT) is runs after the program has started executing, on the fly.

1.       Java Development kit (JDK)

JDK is a software development environment used for making applets and Java applications. The full form of JDK is Java Development Kit. Java developers can use it on Windows, macOS, Solaris, and Linux. JDK helps them to code and run Java programs. It is possible to install more than one JDK version on the same computer.

JDK contains tools required to write Java programs and JRE to execute them.

It includes a compiler, Java application launcher, Appletviewer, etc.

Compiler converts code written in Java into byte code.

Java application launcher opens a JRE, loads the necessary class, and executes its main method.

2.       Java Virtual Machine (JVM):

Java Virtual Machine (JVM) is an engine that provides a runtime environment to drive the Java Code or applications. It converts Java bytecode into machine language. JVM is a part of the Java Run Environment (JRE). In other programming languages, the compiler produces machine code for a particular system. However, the Java compiler produces code for a Virtual Machine known as Java Virtual Machine.

JVM comes with JIT (Just-in-Time) compiler that converts Java source code into low-level machine language. Hence, it runs faster than a regular application.

JVM in Java is responsible for allocating memory space.

3.       Java Runtime Environment (JRE)

JRE is a piece of software that is designed to run other software. It contains the class libraries, loader class, and JVM. In simple terms, if you want to run a Java program, you need JRE. If you are not a programmer, you don’t need to install JDK, but just JRE to run Java programs.

JRE contains class libraries, JVM, and other supporting files. It does not include any tool for Java development like a debugger, compiler, etc.

It uses important package classes like math, swing, util, lang, awt, and runtime libraries.

If you have to run Java applets, then JRE must be installed in your system.

 

 

Different Types of Java Platforms

Java is a programming language that produces software for multiple platforms. When a programmer writes a Java application, the compiled code (known as bytecode) runs on most operating systems (OS), including Windows, Linux and Mac OS. Java derives much of its syntax from the C and C++ programming languages.

1.            (J2SE)  Java 2 Platform, Standard Edition

2.            (J2EE) Java 2 Platform, Enterprise Edition

3.            (J2ME) Java 2 Platform, Micro Edition

 

There are four different types of Java programing language platforms:

1. Java Platform, Standard Edition (Java SE): Java SE’s API offers the Java programming language’s core functionality. It defines all the basis of type and object to high-level classes. It is used for networking, security, database access, graphical user interface (GUI) development, and XML parsing.

2. Java Platform, Enterprise Edition (Java EE): The Java EE platform offers an API and runtime environment for developing and running highly scalable, large-scale, multi-tiered, reliable, and secure network applications.

3. Java Programming Language Platform, Micro Edition (Java ME): The Java ME platform offers an API and a small-footprint virtual machine running Java programming language applications on small devices, like mobile phones.

4. Java FX: JavaFX is a platform for developing rich internet applications using a lightweight user-interface API. It user hardware-accelerated graphics and media engines that help Java take advantage of higher-performance clients and a modern look-and-feel and high-level APIs for connecting to networked data sources.

 

Java SE/J2SE / Core Java /(Java Platform, Standard Edition):

Also known as Core Java, this is the most basic and standard version of Java. It’s the purest form of Java, a Java SE (formerly J2SE) is the basic Java environment. basic foundation for all other editions. J2SE is mainly used to create applications for Desktop environment.

Java SE – Standard Edition (a plain Java version) OR Core Java, Java platform editions, is used to develop Java SE – portable desktop apps. Java Platform, Standard Edition (Java SE) is a computing platform for development and deployment of portable code for desktop and server environments

Java SE stands for Java standard edition and is normally for developing desktop applications, forms the core/base API.

It consist all the basics of Java the language, variables, primitive data types, Arrays, Streams, Strings

(JDK, JRE, JVM, JIT,  Java bean,  AWT/ Swing, Java Database Connectivity(JDBC), APi, Frameworks)

 

Java versions:

JDK 1.0/1.1

J2SE 1.2/1.3/1.4/5.0

Java SE 6/7//8/9/10/11--18

J2EE - Enterprise edition/Java EE (Java Enterprise Edition):

Java EE (formerly J2EE) is the enterprise edition of Java is used to develop enterprise apps, Java EE is an extension for Java SE. J2EE is just a part of Java with a powerful set of libraries, Java EE stands for Java enterprise edition for applications which run on servers, for example web sites.

Beans.

1.       Servlets and JSPs

2.       Framework: Struts Framework , Hibernate Framework , Spring Framework

3.       Working with IDE: Eclipse IDE, Netbeans IDE, Myeclipse IDE,

4.       Servers: Apache Tomcat, Glassfish Server, JBoss Server , Weblogic Server

5.       Web Technology: HTML 5, CSS, Javascript, JQuery, AJAX

6.       EJB3, JNDI , JMS, JPA, EJBQL , MVC, JAR

7.       Design Pattern : Singleton, DAO,DTO,MVC,Front Controller,Factory Method

8.       JUnit, Types of Testing, Maven, Struts2

9.       AOP, ORM, JPA, SpEL, JAXB

 

What does J2EE comprise?/J2EE components

J2EE is comprised of many APIs that can be used to build enterprise applications. the full list of technologies that make up J2EE is as follows:

1.       Java Servlets

2.       JavaServer Pages (JSP)

3.       Enterprise JavaBeans (EJB)

4.       Java Message Service (JMS)

5.       Java Naming and Directory Interface (JNDI)

6.       Java Database Connectivity (JDBC)

7.       JavaMail

8.       Java Transaction Service (JTS)

9.       Java Transaction API (JTA)

10.   J2EE Connector Architecture (J2EE-CA, or JCA)

 

J2ME - Micro edition

J2ME is used to develop mobile apps, Java ME stands for Java micro edition for applications which run on resource constrained devices (small scale devices) like cell phones, for example games.

 

Java is mainly is mainly divided into three parts ie. J2SE, J2ME and J2EE. Java core concepts like Classes, Objects, MultiThreading, Inheritance, Exception Handling, Collections , Strings etc

There is nothing like advance java people just call J2EE concept as advance java.

The topics like Servet, JSP, JMS, EJB , JDBC etc falls in J2EE i.e advance java.

Srping, Strurs and Hibernate are the frameworks means predefined API used to develop Java Application.

Spring framework is popular and widely used framework it having around more than 15 modules like Spring MVC, Spring Security, AOP, ORM etc

Hibernate is a persistence framework and is used to persist Java objects,

Struts is also a web mvc framework just like Spring MVC

 

What is Core Java?

Core Java is the standard edition of Java, also known as J2SE.

What is Advanced Java?

Advanced Java is the enterprise edition of Java, also known as J2EE.

 

Concepts from core Java:

1.       OOPS concepts (Data Abstraction, Encapsulation, Inheritance, Polymorphism)

2.       Basic Java constructs like loops and data types

3.       String handling

4.       Collection framework

5.       Multithreading

6.       Exception handling

7.       Generics

8.       Synchronisation

9.       Serialisation & De-serialisation

10.   Concurrent collection

 

Advanced Java:

1.       JDBC (Java Database Connectivity)

2.       Servlet

3.       JSP

 

Popular Frameworks:

1.       Spring (MVC, Core, JDBC, ORM, AOP)

2.       Hibernate ORM framework

3.       Struts

4.       JSF

5.       Web Services (SOAP & REST)

 

Other:

Design patterns and design questions related to your projects.

 

Early versions of java did not include Collections framework. Instead it defined several classes and one interface to store objects.

 

Web Technologies – Java

From a developer perspective, the main technologies are EJB, JSP, Java Servlets, JDBC and JMS, although JNDI is used for locating EJBs and other enterprise resources. For the moment, let's take a quick look at some of these technologies before moving on to see how to get started with J2EE.

Java, EJB, RMI, Swing, CORBA, Serve lets, JSP, JDBC, Core Java, Struts framework, Web sphere, Web logic, HTML, XML, Java script, J2SE, J2EE, J2ME, DOT NET, framework, LDAP, Internet Security, JVM, Pjava, MIPS, Tibco, Board Design, Ematrix, XSL, XSLT, Java Persistence API (JPA), Object Relational Mapping (ORM frame work), SPRING, Hibernate, Struts

 

Java Fullstack is combination of Frontend and backend

JAVA (frontend) UI: JavaScript, HTML, CSS, DHTML, REST API, Angular, Jquery, React js, Bootstrap, Node js,

JAVA (backend): J2ee, JSF, JSP, Webserices (Rest, SOAP UI), Struts, Spring, hibernate, servlets

 

What is difference between AngularJS, ReactJS and Nodejs?

·         Angular JS is a front-end framework and can be used with any backend programming language like PHP, Java etc. whereas Node JS is simply a server-side language, in a web application like context it acts as a Java on the server side. ... Angular JS runs on the client browser whereas Node JS runs on the server side.

·         AngularJS is fully featured framework than ReactJS, which is not really a framework but a library. ... However, AngularJS has a large support community and following while React is just getting started. On the other hand, Nodejs is simply a JavaScript runtime which is lightweight and fast.

 

 

Java backend developer?

·         Core Java (Must)

·         Get Strong in Data Structures and Algorithms

·         Spring Boot (Learning just Spring boot is enough, don’t learn Spring starters.. just have an idea on IOC, DI, AOP, Security etc.)

·         JPA

·         GraphQL

·         Docker (optional)

·         Kubernetes (optional)

·         AWS / Azure

·         Tools ( IntelliJ Idea, Data Grip, Postgres, iTerm2, Jenkins , Putty, SonarQube, Splunk, Liquibase, Grafana, Nexus,

 

Back-end Development refers to the server-side development.

Learn SQL, JDBC, servlets, REST, JSON. Stay away from Spring, JSP, struts, hibernate and most of the other junk recommended. They’ll just bog you down with needless complexity.

A lot. It depends on where you going to some legacy project (usually backed by EJB, Hibernate) or more modern and fashionable microservices stack (then learn Spring Boot, Spring Data and Docker). Also, in the cloud world Java coding takes little part. For example I develop cloud-hosted software and 80% of my work is doing Docker containers and Kubernetes charts rather than coding in Java.

 

Here’s the list of frameworks for Java back-end development:

1. Spring

Allows you to ‘decrease’ the impact while working with databases from various difficulties, such as:

Resource management and unwrapping

Exception handling

Transaction participation

2. Struts

Uses MVC pattern.

Model components are what the program relies on to exist in a remote database. Views are used to manage interactions with users.

Controllers are used to implement rules that are dependent on user input. Using this pattern means that there is no business-specific processing within the presentation or view of the webpage, making this Java backend framework easier for beginners.

3. Hibernate

Supports object-level relationships and abstraction layer.

Also Tapestry and EJB.

I would like to point out the list of java back-end tools that you might learn and choose for your further carrier:

Java Platforms: Java EE, Java SE, Java ME

UI Frameworks: JSF, XpertIvy, GWF

 

Need to be Strong in JAVA 8 and JAVA 9, Spring IOC ( for Core Skills)

-Spring Boot,ver.x (Microservices)

-JDBC, JPA, Hibernate, Spring JDBC, Spring DATA (for persistance )

-Spring Tx (For Transaction)

-Spring MVC (for MVC)

-Spring REST,JAX-RS (JERSEY) ( For Restful web services)

-,Gradle ,Maven, GIT, Jenkins, dockers, AWS (Java devops)

-Spring Cloud, AWS etc. (Cloud Deployment)

 

additional skills

-Play, GWT, Reddit MQ, Redis, Mongodb, Hadoop, Spark, scala, Restlet.

Framework: Framework, is a platform for developing software applications, Frameworks are large bodies of pre-written code to which you add your own code in order to solve a problem. You make use of a framework by calling its methods, inheritance, and supplying callbacks, listeners, or other implementations of the patterns.

 

Top Java frameworks used are:

1.       Spring

2.       Hibernate

3.       Struts

4.       Google web toolkit [GWT]

5.       JavaServer Faces [JSF]

6.       Grails

7.       Vaadin

8.       Blade

9.       Dropwizard

10.   Play

 

Backend Frameworks:

·         Express

·         Django

·         Rails is a Model-View-Controller framework that uses Ruby

·         Laravel is a Model-View-Controller framework that uses PHP,

·         Spring is a Model-View-Controller framework that uses Java,

 

Frontend Javascript Frameworks

·         Angular

·         React - React is not a framework, it’s a frontend library, but many developers consider it a framework

·         Vue

·         Ember

·         Backbone

·         AngularJS vs ReactJS vs NodeJS

 

Micro Services frameworks-

Spring Boot, Spark, Swagger, dropwizard, play framework, Jersey, restlet, restx

Java Script Frameworks

AngularJS, ReactJS, NodeJS, VueJS, Polymer, Ember.JS, Backbone.js, Metor, Mithril, Aurelia

Microservices are a form of service-oriented architecture style  wherein applications are built as a collection of different smaller services rather than one whole app.

Microservices/Spring Boot
Microservices architecture is a term used to describe the practice of breaking up an application into a series of smaller, more specialised parts, each of which communicate with one another across common interfaces such as APIs and REST interfaces like HTTP.

 

What is difference between Web services and Microservices?

·         Microservices are small, autonomous services that work together, while web services are any service that is available over the internet and is built using standard internet technologies. Microservices are a set of small self-sustained small services or applications designed to solve problems for systems that are big.

·         Microservices are a form of service-oriented architecture style (one of the most important skills for Java developers) wherein applications are built as a collection of different smaller services rather than one whole app.

 

Spring is used to develop application from desktop to Web. Hibernate is used to access data layer and Struts is used for Web frameworks.

Spring Boot is an open source Java-based framework used to create a micro Service.

Spring VS Springboot: Spring Boot. While the Spring framework focuses on providing flexibility to you, Spring Boot aims to shorten the code length and provide you with the easiest way to develop a web application. With annotation configuration and default codes, Spring Boot shortens the time involved in developing an application

 

IDE (integrated development environment):

An integrated development environment is a software application that provides comprehensive facilities to computer programmers for software development. An IDE normally consists of at least a source code editor, build automation tools and a debugger.

Top free IDE for Java Coding, Development & Programming:

1.       NetBeans

2.       Eclipse

3.       IntelliJ IDEA

4.       Android Studio

5.       Enide Studio 2014

6.       BlueJ

7.       jEdit

8.       jGRASP

9.       JSource

10.   JDeveloper

11.   DrJava

 

Java IDE (Compiler / Editor) for Windows, Mac, Linux /Best Online Java Programming IDEs & Compilers

NetBeans is FREE, open-source IDE. It is one of the best Java developer tools which allows developing desktop, mobile and web applications.

Eclipse 

Tabnine               

IntelliJ IDEA       

BlueJ    

MyEclipse           

 

 

JUnit:

JUnit is an open source unit testing tool for Java programming language. It is important Java development tool for test-driven development and deployment.

 

JMeter is an open source load testing tool. It is designed to load functional test behavior and measure performance of websites.

 

Apache Maven is a software Project Management Tool. It is based on the Project Object Model (POM) concept.

 

Mockito is an Open Source Java Mocking and Unit Testing Tool. Mockito is a popular open source Java mocking framework. It helps developers to write clean, well-designed and loosely-coupled code.

 

Gradle is a project automation Java tool. It builds on the features of Apache Ant and Apache Maven. It also serves as the default build tool for the Android platform.

 

Groovy is a powerful language with static-typing & compilation capabilities. It is aimed at improving developer’s productivity.

 

Spark is a robust Java based framework for developing web applications. It allows Java developers to create web applications without the need of writing boilerplate code.

 

 

JS (JavaScript), JQuery, Ajax:

JavaScript is an interpreted computer programming language that makes websites more interactive by using web pages as a significant element.

JQuery: JQuery is a library of JavaScript Functions.JQueryacts as the framework of JavaScript.

jQuery is a lightweight, "write less, do more", JavaScript library. The purpose of jQuery is to make it much easier to use JavaScript on your website. jQuery takes a lot of common tasks that require many lines of JavaScript code to accomplish, and wraps them into methods that you can call with a single line of code.

Ajax (Asynchronous JavaScript and XML):

jQuery - Ajax. AJAX is an acronym standing for Asynchronous JavaScript and XML and this technology helps us to load data from the server without a browser page refresh. If you are new with AJAX.

JavaScript is client-side, i.e., in the browser scripting language, whereas jQuery is a library (or framework) built with JavaScript. Meanwhile, AJAX is a method to immediately update parts of the UI without reloading the web pages.

EJB (Enterprise JavaBeans):

EJB is the server-side and platform-independent Java application programming interface (API) for Java Platform, Enterprise Edition (Java EE). EJB is used to simplify the development of large distributed applications.

Enterprise Java Beans

EJB stands for Enterprise Java Beans. EJB is an essential part of a J2EE platform. J2EE platform has component based architecture to provide multi-tiered, distributed and highly transactional features to enterprise level applications.

JNDI (Java Naming and Directory Interface): JNDI is a Java API for a directory service that allows Java software clients to discover and look up data and resources (in the form of Java objects) via a name. Like all Java APIs that interface with host systems, JNDI is independent of the underlying implementation.

JNDI (Java Naming and Directory Interface) enables Java platform-based applications to access multiple naming and directory services.

JMS (The Java Message Service): JMS API is a Java message-oriented middleware API for sending messages between two or more clients. It is an implementation to handle the producer–consumer problem. Java Message Service (JMS) is an application program interface (API) from Sun Microsystems that supports the formal communication known as messaging between computers in a network. JMS API is used to create, send, receive and read messages or exchange messages between different systems.

JavaMail is a Java API used to send and receive email via SMTP, POP3 and IMAP. JavaMail is built into the Java EE platform, but also provides an optional package for use in Java SE.

JPA (The Java Persistence API): JPA is a Java specification for accessing, persisting, and managing data between Java objects / classes and a relational database. JPA was defined as part of the EJB 3.0 specification as a replacement for the EJB 2 CMP Entity Beans specification. JPA also requires a database to persist to.

EJB QL or EJB-QL is a portable database query language for Enterprise Java Beans. It was used in Java EE applications. Compared to SQL, however, it is less complex but less powerful as well.

JAR (Java ARchive): A JAR is a package file format typically used to aggregate many Java class files and associated metadata and resources into one file for distribution. It is used to store classes of java created by the user in order to help the runnable and inference concepts embedded within the language.

A JAR (Java ARchive) is a way of packaging together all of the resources associated with a program (class files, images, sounds, etc.). Putting your program in a JAR allows it to be distributed as a single executable file, saving space and simplifying the download process.

The Java Transaction Service (JTS) is a specification for building a transaction manager that maps onto the Object Management Group (OMG) Object Transaction Service (OTS) used in the Common Object Request Broker Architecture (CORBA) architecture. The Java Transaction API, one of the Java Enterprise Edition APIs, enables distributed transactions to be done across multiple X/Open XA resources in a Java environment. JTA is a specification developed under the Java Community Process as JSR 907.

JCA (Java EE Connector Architecture): Java EE Connector Architecture (JCA) is a Java-based tool for connecting application servers and enterprise information systems (EIS) as part of enterprise application integration (EAI) solutions. While JDBC is specifically used to connect Java EE applications to databases, JCA is a more generic architecture for connection to legacy systems. JCA was developed under the Java Community Process as JSR 16 (JCA 1.0), JSR 112 (JCA 1.5) and JSR 322 (JCA 1.6).

Mocha or Jasmine - JavaScript Testing Framework

 

Design Patterns in Java:

Design patterns represent the best practices used by experienced object-oriented software developers. Design patterns are solutions to general problems that software developers faced during software development.In the context of Java, design patterns are divided into three categories – creational, structural, and behavioral patterns.

MVC Design Pattern, DAO (Data Access Object Pattern),Data transfer object (DTO), formerly known as value objects or VO, is a design pattern used to transfer data between software application subsystems.

Singleton design pattern, Front controller design pattern, Factory method is a creational design pattern.

Design architectures: MVC, MVVM, MVVM-C, MVC-C, MVP

MVC (Model-View-Controller): MVC is an application design model comprised of three interconnected parts. The MVC model or "pattern", View & Controller is commonly used for developing modern user interfaces. It is provides the fundamental pieces for designing a programs for desktop or mobile, as well as web applications. The Model-View-Controller (MVC) is an architectural pattern that separates an application into three main logical components: the model, the view, and the controller. MVC is one of the most frequently used industry-standard web development framework to create scalable and extensible projects.

AOP (Aspect oriented programming): AOP framework is one of the key components of Spring Framework .

ORM (Object-relational mapper): ORM is a code library that automates the transfer of data stored in relational databases tables into objects that are more commonly used in application code. Hibernate is an ORM framework.

SpEL - Spring Expression Language

JAXB: Java Architecture for XML Binding is a software framework that allows Java developers to map Java classes to XML representations.

Apache Struts 2 is an open-source web application framework for developing Java EE web applications. It uses and extends the Java Servlet API to encourage developers to adopt a model–view–controller architecture.

Groovy:

Apache Groovy is a Java-syntax-compatible object-oriented programming language for the Java platform. It is both a static and dynamic language with features similar to those of Python, Ruby, and Smalltalk. Java is strongly and statically typed language whereas Groovy is dynamically and optionally typed language . The best things about groovy is that Since it extends JDK , it accepts the java code.

WSDL (Web Services Description Language):

·         WSDL is an XML format for describing network services as a set of endpoints operating on messages containing either document-oriented or procedure-oriented information.

·         The Web Services Description Language is an XML-based interface description language that is used for describing the functionality offered by a web service.

Scripting language:

A script or scripting language is a computer language with a series of commands within a file that is capable of being executed without being compiled. Good examples of server-side scripting languages include Perl, PHP, and Python. The best example of a client side scripting language is JavaScript.

Python is considered a scripting language because of a historical blur between scripting languages and general purpose programming languages. In fact, Python is not a scripting language, but a general purpose programming language that also works a nicely scripting language.

What is difference between programming language and scripting language?

Basically, all scripting languages are programming languages. The theoretical difference between the two is that scripting languages do not require the compilation step and are rather interpreted. Generally, compiled programs run faster than interpreted programs because they are first converted native machine code.

 

 

Java 8 experience • SQL (MySQL or PostgreSQL) and NoSQL (MongoDB or Cassandra) • Cloud Infrastructure • JPA and ORM frameworks • 3 years + using Spring Framework • Able to create RESTful APIs • Agile, Scrum, Kanban, Junit, Mockito • Building micro services (Spring Boot) • JavaScript (NodeJS, AngularJS, ReactJS) • Object Orientated programming and designs • Full Stack Development Desirable Skills • Docker • Jenkins, GIT, Maven, Jira etc • Elastic Search, Logstash, Kibana

 

Summary:

·         Expertise in the web application development using HTML 5, CSS 3, JavaScript, jQuery, AngularJS, Angular 2, Angular 4, Typescript, ES6, ES7, ReactJS, NodeJS, ExtJS, BackboneJS and Bootstrap.

·         Extensively worked on n-tier architecture systems with application system development using Java, JDBC, JSP, EJB, Servlets, Struts2, Spring Framework, Hibernate, JPA, JSTL, JSF, JNDI, JMS, JavaScript, Web services, WSDL, REST, SOAP, and XML.8

·         Extensive experience in design and development of J2EE applications using Core Java (J2SE 1.7), Java Collection Framework, Swing, JDBC, JDK, Servlets, JSP, EJB, Spring Framework, Hibernate, Struts, Web services, WSDL, REST, SOAP, Enterprise Java Beans, XML, XSLT, Java Beans, and JQuery.

·         Experience in developing and a solid understanding of SOA and Microservices Architecture.

·         Strong experience in working with Relational databases like Oracle, MySQL, Microsoft SQL Server, PostgreSQL and NoSQL databases like MongoDB, Apache Cassandra

·         back-end RDBMS tools like Oracle 9i/10G and MySQL.

·         Strong experience in implementing MVC framework like Struts 2.0, Spring 2.x and ORM tools like Hibernate in J2EE architecture.

·         Strong Knowledge of Object Oriented Design Methodologies such as Polymorphism, Inheritance and Encapsulation.

·         Experience in developing Android application using SQLite, Java, Mobile JQuery, Eclipse IDE,Android Studio, Android SDK and ADT plug in.

·         Experienced in build tools like Ant and Maven, Log4j for Logging and jUnit for testing.

·         Experience in implementing the MVC architecture in backend applications using Node.js along with ExpressJS that interacts with MongoDb and performed CRUD operation on MongoDb.

·         Proficient in working across all stages of Software Development Life Cycle (SDLC) and Agile methodologies.

·         Expertise in using J2EE Application Servers such as IBM WebSphere 4.x/5.x/6.x, WebLogic, JBoss 3.x and Web Servers like Tomcat 5.x/6.x

·         Extensively used IDE for Application development like RAD 6.0, Eclipse3.x, Net Beans

·         Experiences with build tools include Maven, Gradle and Jenkins Version.

·         Development experience includes working with cross functional team and global development teams in Onshore/Offshore Model.

 

Java Bean - JavaBeans are classes that encapsulate many objects into a single object (the bean). It is a java class in java.

AWT/Swing:

AWT (Abstract Window Toolkit): AWT is an API to develop GUI or window-based applications in java. It is to create graphical user interface ( GUI ) objects, such as buttons, scroll bars, and windows. AWT is part of the Java Foundation Classes ( JFC ) from Sun Microsystems.

Swing

·         Swing is a set of program components for Java programmers that provide the ability to create graphical user interface ( GUI ) components, such as buttons and scroll bars, that are independent of the windowing system for specific operating system. Swing components are used with the Java Foundation Classes ( JFC ).

·         Swing Framework contains a set of classes that provides more powerful and flexible GUI components than those of AWT. Swing provides the look and feel of modern Java GUI. Swing library is an official Java GUI tool kit released by Sun Microsystems. It is used to create graphical user interface with Java.

JDBC (Java Database Connectivity): JDBC is a Java API to connect and execute the query with the database. It is a part of JavaSE (Java Standard Edition). JDBC API uses JDBC drivers to connect with the database.

 

API (Application program interface):

·         An API is a software intermediary that allows two applications to talk to each other. In other words, an API is the messenger that delivers your request to the provider that you're requesting it from and then delivers the response back to you.It is the way for an application to interact with certain system/application/library/etc.

·         It is a mechanism that allows the interaction between two applications using a set of rules. The interaction between applications refers to when one application wants to access data that another application holds or send the data to the said application. It can also be when one application is requesting services from another application.

·         API provides interactions between one software and another, but not users, For example, by including or integrating a Javascript Google Maps API in the code, developers can add the feature of interactive Google Maps to an application or a web page. Another example is a YouTube Data API. Using this API, developers can include YouTube functionality to the site to retrieve and manipulate resources like videos, playlists, and channels.

API models – Public & Private APIs

API stands for Application Programming Interface, i.e. API is the way for an application to interact with certain system/application/library/etc.

Web APIs:

Among several API types, web APIs are widely used to integrate software or a service in a website or app through World Wide Web. That means through HTTP protocol the exchange of data or information occurs between desktop, mobile and web applications. Depending on the data transfer formats used in request-response messaging, web APIs are classified as SOAP (Simple Object Access Protocol), RPC (Remote Procedure Call), and REST (Representational State Transfer). These are the different protocols through which exchange of information takes place over web. The most common data formats used to define the response / request messages are XML, JSON, HTML or binary files for documents, videos and images.

The web APIs are further divided into client and server side based on how they extend their functionality in web browser. Client side APIs are broadly used for manipulating different aspects of browser whereas server side APIs are meant for executing functionality on a server before the data is sent to browser. When a request is made to an API, the result will be in the form of response invoking an action. But there are some special server side APIs called webhooks that act as user-defined HTTP callbacks to invoke a behaviour or event. By configuring an event in one website, an action can be automatically invoked in the other. That means whenever the condition is met in the source site, webhooks acknowledge the event, and triggers the action on the url specified in the form of HTTP request. Today, webhooks are widely used for passing the information or triggering specific events between applications and servers.

APIs VS Web Services

·         A web service and an API are two very similar concepts, so it can be difficult to understand the similarities and differences.

·         A web service is a system or software that uses an address, i.e., URL on the World Wide Web, to provide access to its services. A Web service is a way for two machines to communicate with each other over a network.

Web service APIs

Apart from the main web APIs, there are also web service APIs:

1.       SOAP

2.       XML-RPC

3.       JSON-RPC

4.       REST

The following are the most common types of web service APIs:

SOAP (Simple Object Access Protocol): This is a protocol that uses XML as a format to transfer data. Its main function is to define the structure of the messages and method of communication. It also uses WSDL, or Web Services Definition Language, in a machine-readable document to publish a definition of its interface.

XML-RPC: This is a protocol that uses a specific XML format to transfer data compared to SOAP that uses a proprietary XML format. It is also older than SOAP. XML-RPC uses minimum bandwidth and is much simpler than SOAP.

JSON-RPC: This protocol is similar to XML-RPC but instead of using XML format to transfer data it uses JSON.

REST (Representational State Transfer): REST is not a protocol like the other web services, instead, it is a set of architectural principles. The REST service needs to have certain characteristics, including simple interfaces, which are resources identified easily within the request and manipulation of resources using the interface.

A RESTful API is an application program interface (API) that uses HTTP requests to GET, PUT, POST and DELETE data. ... REST technology is generally preferred to the more robust Simple Object Access Protocol (SOAP) technology because REST leverages less bandwidth, making it more suitable for internet usage.
A REST API defines a set of functions which developers can perform requests and receive responses via HTTP protocol such as GET and POST. ... The World Wide Web (WWW) is an example of a distributed system that uses REST protocol architecture to provide a hypermedia driven interface for websites.

REST stands for REpresentational State Transfer. REST is web standards based architecture and uses HTTP Protocol.

REST stands for REpresentational State Transfer. REST is used to build web services that are lightweight, maintainable, and scalable in nature. More and more applications are moving to the Restful architecture.

REST VS RESTful

·         REST stands for Representational State Transfer. ... REST is an architecture all about client-server communication. RESTful web services are web services which are REST based. With RESTful services you an do anything you already do with normal web services.

·         A RESTful API -- also referred to as a RESTful web service -- is based on representational state transfer (REST) technology, an architectural style and approach to communications often used in web services development.

 

JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write.

Differences between SOAP and REST

SOAP                                                                                                          REST

It has strict rules and advanced security to follow.             There are loose guidelines to follow allowing developers to

 make recommendations easily

It is driven by Function                                                                  It is driven by Data

It requires more Bandwidth                                                         It requires minimum Bandwidth

 

Differences between JSON and XML

JSON                                                                                                                         XML

Supports only text and numbers.                              Supports various types of data for example text, numbers, images, graphs, charts etc.

Focuses mainly on Data                                                Focuses mainly on Document.

It has low security                                                            It has more security

 

·         XML [eXtensible Markup Language] is a standardized format for storing and sending data. Similar to HTML, XML stores data by wrapping it in descriptive tags.

·         JSON [JavaScript Object Notation] is similar to XML in that it also stores and enables you to send data in a standardized format. JSON just uses a different, object-based, methodology for systematically storing data.

·         HTTP [HyperText Transfer Protocol] is the foundation of transferring data and communications on the internet.

·         SOAP [Simple Object Access Protocol] is a messaging protocol used for exchanging structured information[XML data] over a network.

·         REST [REpresentational State Transfer] is a standardized architectural style that can be used when creating a web API.

·         Web applications (Web app) are computer programs that are accessed over the internet through a computer’s web browser.

 

 

Applet:

An Applet is a client side java program that runs within a Web browser on the client machine. On the other hand, a servlet is a server side component that runs on the web Page on server. An applet can use the user interface classes, while a servlet does not have a user interface.

Servlets:

Servlets are the Java programs that runs on the Java-enabled web server or application server. They are used to handle the request obtained from the web server, process the request, produce the response, then send response back to the web server. Properties of Servlets : Servlets work on the server-side. Servlet is a java code.

JSP (JavaServer Pages):

JSP is a server side technology that does all the processing at server. It is used for creating dynamic  web applications, using java as programming.  JavaServer Pages (JSP) is a collection of technologies that helps software developers to create dynamically generated web pages based on HTML, XML, SOAP, or other document types. JSP is similar to

PHP and ASP, but it uses the Java programming language.  JSP is a html based code. Servlet is faster than JSP.

 

 

 

Java/J2EE Technologies

Core JAVA/J2EE, Spring Framework 5, Spring Boot, hibernate, JSP, Servlets, JavaBeans, Struts, JDBC, ODBC, JNDI, RMI, JSP Custom Tag Libraries, XML, Java  API, ANT, Restful     /SOAP Webservices, Servlets, Spring MVC

Design Patterns

MVC, DAO, Front Controller, Session Facade, Singleton

Frameworks

Struts, Hibernate, Spring 4.0, Spring Boot.

Methodologies

Agile, Waterfall and SDLC.

Application Servers

WebLogic 12, JBoss 4.0, Apache Tomcat 7.x/8.x/9.x, Web Sphere 7.5

Cloud Servers

Amazon EC2, Amazon S3, AWS Lambda, Amazon SQS, AWS Identity and access management, AWS CloudWatch, Amazon EBS.

Webservices

SOAP, rest, Webservices.

Advanced Java Scripts

React JS, AngularJS

Database

PL/SQL, Mongodb, PostgreSQL, Oracle 11g, SQL Server 2008 and 2012, MYSQL and MS Access.

Version Control

Git, Maven, MS Office, GitHub, SVN.

Operating Systems

Windows, Linux                                        

Debugging Tools

IE developer tools, Integrated Eclipse debugger, SOAP UI, Postman, Jenkins, Docker, Splunk, Maven

IDE

Eclipse, NetBeans, IntelliJ Idea, SOAP UI.

Testing/ Logging Tools

JUnit, Log4j 

Web Development

HTML, JavaScript, jQuery, CSS, XML, JSON.

 

 

 

 

 

TECHNICAL SKILLS for Java developers:

 

Languages

Core Java 1.5/1.7/1.8, J2EE, SQL, PL/SQL, HTML, DHTML, ES6, JavaScript 1.5, UML, XML, XSL, XSLT,  PHP, C#, Java, SQL, PLSQL, C, C++.

Java (1.5/1.6/1.7/1.8), C, PL/SQL,

Java/J2EE Technologies

JSP, Servlets, JNDI, JDBC, EJB, JMS, Struts, Hibernate, Springs, AJAX, Web Services (SOAP, WSDL, UDDI), SAX, Restful Web Service, HTML, XML, XSL, XSD, XSLT.

JSP (2.x), JSTL, Servlets (3.1,3.0), EJB, JDBC, Java Beans XSD, JAX-RS, JAX-WS, SOAP, WSDL, Axis, Java Security, JBPM JDBC, JavaScript, JSP, Servlets, JQuery

Web Technologies         

HTml4/5, CSS 2/3, XML, DHTML, Bootstrap-3, Object Oriented JavaScript, JSON, SEO, Typescript, JSP, Servlets, JAX-WS, EJB, ES6

HTML, DHTML, AJAX, Bootstrap, JavaScript, jQuery, XML, XSLT, XSL, CSS, JSON, Node Js, AngularJS, Angular 6, React

Web service Frameworks

Spring (4.x/3.x), Hibernate (5.x,4.x,3.x), Struts (2.5/2.3), Spring MVC, Spring IOC, Spring Boot, Spring AOP, Spring Web Flow, JSF, Log 4J, Junit

Web Services

SOAP, RESTful, Oracle SOA, UDDI, WSDL

JavaScript frameworks & libraries

jQuery, AngularJS (v1.5), Angular 2.0, React.js, Node.js, AJAX, Express.js, Require.js.

Framework and Tools

Struts framework, spring, Hibernate. Spring Boot, Hibernate, Selenium, Cucumber and JPA.

Design Methods/Patterns

Design Patterns, OOA/OOD,  Singleton, Business Delegate, Data Transfer Object, Façade, Data Access Object, MVC.

NodeJS modules

Http, URL, Morgan, Events, Path, FS, UTIL

Databases

Oracle(9i/10g/11g/12c), SQL Server (14.0), DB2, MySQL, Postgres SQL, Mongo DB, Cassandra Microsoft Access, MS SQL

No SQL Databases:

Cassandra, mongo DB, Kibana

IDE’s/Development tools

Eclipse, My Eclipse, RAD 7.0/6.0, IntelliJ, Sublime, Brackets, Notepad++, NetBeans Rational Software Architect (RSA), Rational Application Developer (RAD 6.0), Eclipse, Net Beans, IntelliJ and TOAD.

Eclipse (4.x/3.x (Neon, Oxygen, Kepler, Luna, Indigo, Juno)), Net Beans, IntelliJ, Spring Tool Suite, RAD 9.0, JBPM 6

Application/Web Servers

IBM WebSphere, WebLogic, JBoss and Apache Tomcat

Web Logic Server 12c, Web Sphere Application Server 8.5, Apache Tomcat (8.5/8.0), Apache HTTP Server, IBM HTTP Server (8.5) Apache Tomcat6.0/7.0/8.0, JBoss

Frameworks

Struts, Hibernate 3.0/4.0, Spring MVC 4.0, Ruby on Rails JSF, Spring Boot, Spring AOP, Spring IOC, Design patterns

Operating Systems

Windows, UNIX, Solaris, Red Hat, Linux Windows XP/2000/NT/98/95, UNIX. Windows, Unix, Linux, Mac OS

Version Control Tools

CVS, SVN, GIT. Git Hub, CVS, Sub Version,  GIT, SVN, Clear Case, Rational Rose

Tools/Utilities

Log4j, CMS, Ant, JUnit, AWS, Caliber, Maven, Gradle 2.1, Jenkins, SOAPUi, JasperReports

Software development Methodologies

Agile (Scrum, TDD), Waterfall, SDLC

Protocols

HTTP, TCP/IP, SOAP, SMTP, LAN and WAN

Testing Tools

Eclipse, WSAD, RAD, CVS, J-Builder, J-Developer, Ant, Maven JUnit3.8/4.0 and Test Driven Development (TDD), JMeter, Selenium.

JUnit, Log4J, Mock Framework, Cucumber, Selenium Junit, SoapUI, Putty, Mockito

Automation Tools

Selenium RC, Selenium Webdriver, Selenium Grid, Selenium IDE and AutoIT.

Documentation Tools

MS Office 97/2000/2002, Visio, MS Project

XML Technologies

DTD, XSD, XML, WSDL, SAX, DOM, RESTful and SOAP Services.

UI Technologies

HTML, CSS, Java script, JQuery, Angular JS, Node JS, Bootstap.

Web/App Servers

Web Sphere 6.1, WebLogic 10.3, Tomcat 5.5/6.0, Jboss6.1.

Build Tools/  Build Scripts

Maven, Ant, and Jenkins

Cloud Technologies, DevOps Tools & Other

AWS, EC2, Pivotal Cloud Foundry (PCF), Docker, JIRA

O-R Mapping

Hibernate, JPA

 

Basics Concepts of Object-Oriented Programming (OOPs)

OOPs Concepts in Java

Object-Oriented Programming System (OOPs) is a programming concept that works on the principles of abstraction, encapsulation, inheritance, and polymorphism. It allows users to create objects they want and create methods to handle those objects. The basic concept of OOPs is to create objects, re-use them throughout the program, and manipulate these objects to get results.

OOP meaning “Object Oriented Programming” is a popularly known and widely used concept in modern programming languages like Java.

List of OOPs Concepts in Java with Examples

The following are general OOPs concepts in Java:

1) Class

The class is one of the Basic concepts of OOPs which is a group of similar entities. It is only a logical component and not the physical entity. Lets understand this one of the OOPs Concepts with example, if you had a class called “Expensive Cars” it could have objects like Mercedes, BMW, Toyota, etc. Its properties(data) can be price or speed of these cars. While the methods may be performed with these cars are driving, reverse, braking etc.

2) Object

An object can be defined as an instance of a class, and there can be multiple instances of a class in a program. An Object is one of the Java OOPs concepts which contains both the data and the function, which operates on the data. For example – chair, bike, marker, pen, table, car, etc.

3) Inheritance

Inheritance is one of the Basic Concepts of OOPs in which one object acquires the properties and behaviors of the parent object. It’s creating a parent-child relationship between two classes. It offers robust and natural mechanism for organizing and structure of any software.

4) Polymorphism

Polymorphism refers to one of the OOPs concepts in Java which is the ability of a variable, object or function to take on multiple forms. For example, in English, the verb run has a different meaning if you use it with a laptop, a foot race, and business. Here, we understand the meaning of run based on the other words used along with it. The same also applied to Polymorphism.

5) Abstraction

Abstraction is one of the OOP Concepts in Java which is an act of representing essential features without including background details. It is a technique of creating a new data type that is suited for a specific application. Lets understand this one of the OOPs Concepts with example, while driving a car, you do not have to be concerned with its internal working. Here you just need to concern about parts like steering wheel, Gears, accelerator, etc.

6) Encapsulation

Encapsulation is one of the best Java OOPs concepts of wrapping the data and code. In this OOPs concept, the variables of a class are always hidden from other classes. It can only be accessed using the methods of their current class. For example – in school, a student cannot exist without a class.

7) Association

Association is a relationship between two objects. It is one of the OOP Concepts in Java which defines the diversity between objects. In this OOP concept, all objects have their separate lifecycle, and there is no owner. For example, many students can associate with one teacher while one student can also associate with multiple teachers.

8) Aggregation

In this technique, all objects have their separate lifecycle. However, there is ownership such that child object can’t belong to another parent object. For example consider class/objects department and teacher. Here, a single teacher can’t belong to multiple departments, but even if we delete the department, the teacher object will never be destroyed.

9) Composition

Composition is a specialized form of Aggregation. It is also called “death” relationship. Child objects do not have their lifecycle so when parent object deletes all child object will also delete automatically. For that, let’s take an example of House and rooms. Any house can have several rooms. One room can’t become part of two different houses. So, if you delete the house room will also be deleted.

 

Advantages of OOPs (Object-Oriented Programming System):

OOPs Concepts in Java offer easy to understand and a clear modular structure for programs.

Objects created for Object-Oriented Programs can be reused in other programs. Thus it saves significant development cost.

Large programs are difficult to write, but if the development and designing team follow OOPS concepts, then they can better design with minimum flaws.

It enhances program modularity because every object exists independently.

 

 

Java Basics Language Constructs

 

👉 Lesson 1       Java Variables — What is & Data Types with Example

👉 Lesson 2       Class and Object in Java OOPS — Learn with Example

👉 Lesson 3       Java Arrays Tutorial — Declare, Create, Initialize with Example

👉 Lesson 4       Array of Objects — How to Create Array of Objects in Java

👉 Lesson 5       ArrayList in Java — How to Use, Methods & Examples

 

Java Variables and Data Types with EXAMPLE

What is a Variable in Java?

Variable in Java is a data container that stores the data values during Java program execution. Every variable is assigned data type which designates the type and quantity of value it can hold. Variable is a memory location name of the data. The Java variables have mainly three types : Local, Instance and Static.

In order to use a variable in a program you to need to perform 2 steps

Variable Declaration

Variable Initialization

 

Types of variables

In Java, there are three types of variables:

1.       Local Variables

2.       Instance Variables

3.       Static Variables

 

1) Local Variables: Local Variables are a variable that are declared inside the body of a method.

2) Instance Variables: Instance variables are defined without the STATIC keyword .They are defined Outside a method declaration. They are Object specific and are known as instance variables.

3) Static Variables: Static variables are initialized only once, at the start of the program execution. These variables should be initialized first, before the initialization of any instance variables.

 

What is Data Types in Java?

Data Types in Java are defined as specifiers that allocate different sizes and types of values that can be stored in the variable or an identifier. Java has a rich set of data types. Data types in Java can be divided into two parts :

Primitive Data Types :- which include integer, character, boolean, and float

Non-primitive Data Types :- which include classes, arrays and interfaces.

 

Primitive Data Types

Primitive Data Types are predefined and available within the Java language. Primitive values do not share state with other primitive values.

There are 8 primitive types: byte, short, int, long, char, float, double, and boolean

 

 

Java Data Types

 

 

👉 Lesson 2       Class and Object in Java OOPS

What is Class and Object in Java OOPS? Learn with Example

Classes and Objects in Java are the fundamental components of OOP’s. Often there is a confusion between classes and objects.

What is Class in Java?

Class are a blueprint or a set of instructions to build a specific type of object. It is a basic concept of Object-Oriented Programming which revolve around the real-life entities. Class in Java determines how an object will behave and what the object will contain.

What is Object in Java?

Object is an instance of a class. An object in OOPS is nothing but a self-contained component which consists of methods and properties to make a particular type of data useful. For example color name, table, bag, barking. When you send a message to an object, you are asking the object to invoke or execute one of its methods as defined in the class.

 

From a programming point of view, an object in OOPS can include a data structure, a variable, or a function. It has a memory location allocated. Java Objects are designed as class hierarchies.

 

What is the Difference Between Object and Class in Java?

A Class in object oriented programming is a blueprint or prototype that defines the variables and the methods (functions) common to all Java Objects of a certain kind.

 

An object in OOPS is a specimen of a class. Software objects are often used to model real-world objects you find in everyday life.

 

Class – Dogs

Data members or objects– size, age, color, breed, etc.

Methods– eat, sleep, sit and run.

Java Class is an entity that determines how Java Objects will behave and what objects will contain

A Java object is a self-contained component which consists of methods and properties to make certain type of data useful

A class system allows the program to define a new class (derived class) in terms of an existing class (superclass) by using a technique like inheritance, overriding and augmenting.

 

 

👉 Lesson 3       Java Arrays Tutorial — Declare, Create, Initialize with Example

What is Java Array?

Java Array is a very common type of data structure which contains all the data values of the same data type. The data items put in the array are called elements and the first element in the array starts with index zero. Arrays inherit the object class and implement the serializable and cloneable interfaces. We can store primitive values or objects in an array.

 

In simple words, it’s a programming construct which helps to replace this

Array Variables

Using an array in your program is a 3 step process –

1) Declaring your Array

2) Constructing your Array

3) Initialize your Array

 

What Is An Array Of Objects?

Java Array Of Objects, as defined by its name, stores an array of objects. Unlike a traditional array that store values like string, integer, Boolean, etc an array of objects stores OBJECTS. The array elements store the location of the reference variables of the object.

 

What is ArrayList in Java?

ArrayList in Java is a data structure that can be stretched to accommodate additional elements within itself and shrink back to a smaller size when elements are removed. It is a very important data structure useful in handling the dynamic behavior of elements.

 

ArrayList are like Rubber band & Arrays are like a rope.

 

 

Learn Java String Tutorial

👉 Lesson 1       Java String — Java String Manipulation: Functions and Methods

👉 Lesson 2       String Length() Method in Java — Learn with Example

👉 Lesson 3       String indexOf() Method in Java — Learn with Example

👉 Lesson 4       String charAt() Method in Java — Learn with Example

👉 Lesson 5       String compareTo() Method in Java — How to Use with Examples

👉 Lesson 6       String contains() Method in Java — Check Substring with Example

👉 Lesson 7       String endsWith() Method in Java — Learn with Example

👉 Lesson 8       Java String replace() Method — Learn with Example

👉 Lesson 9       Java String toLowercase() and toUpperCase() Methods — Learn with Example

👉 Lesson 10     Java Convert String to int — How to convert & Example

👉 Lesson 11     HashMap in Java — What is Hashmap? Features & Example

Most Misunderstood Topics!

 

👉 Lesson 1       Java Command Line Arguments — Learn with Example

👉 Lesson 2       “this” keyword in Java — What is & How to use with Example

 

 

 

What are Strings?

A string in literal terms is a series of characters. Hey, did you say characters, isn’t it a primitive data type in Java. Yes, so in technical terms, the basic Java String is basically an array of characters.

 

Why use Strings?

One of the primary functions of modern computer science, is processing human language.

Similarly to how numbers are important to math, language symbols are important to meaning and decision making. Although it may not be visible to computer users, computers process language in the background as precisely and accurately as a calculator. Help dialogs provide instructions. Menus provide choices. And data displays show statuses, errors, and real-time changes to the language.

 

As a Java programmer, one of your main tools for storing and processing language is going to be the String class.

 

What is String “Length” Method in Java?

This function is used to get the length of string in Java. The string length method returns the number of characters written in the String. This method returns the length of any string which is equal to the number of 16-bit Unicode characters in the string.

 

What is indexOf() Method in Java?

indexOf() Method is used to get index of the first occurrence of a criteria specified in the parameters of the IndexOf method.

 

A common scenario can be when a system admin wants to find the index of the ‘@’ character of the email Id of a client and then wants to get the remaining substring. In that situation, IndexOf method can be used.

 

What is Java String charAt() Method?

The Java String charAt() method returns the character at the definite index from a string. In this Java method, the string index value starts from 0 and goes up to string length minus 1 (n-1).

 

What is compareTo() method in Java?

compareTo() is used for comparing two strings lexicographically. Each character of both strings are converted into a Unicode value. However, if both the strings are equal, then this method returns 0 else it only result either negative or positive value.

 

The Java String compareTo() method is defined in interface java.lang.Comparable

 

Java String contains() method

The Java String contains() method is used to check whether the specific set of characters are part of the given string or not. It returns a boolean value true if the specified characters are substring of a given string and returns false otherwise. It can be directly used inside the if statement.

 

Java String endsWith()

The Java String endsWith() method is used to check whether the string is ending with user-specified substring or not. Based on this comparison it returns the result in boolean value true if the specific suffix is matched or it returns false if the suffix does not match.

 

The String Class Java has three types of Replace methods:

replace()

replaceAll()

replaceFirst()

With the help of replace() function in Java, you can replace characters in your string. Lets study each Java string API functions in details:

 

Java String replace() Method

Java String replace() method replaces every occurrence of a given character with a new character and returns a new string. The Java replace() string method allows the replacement of a sequence of character values.

 

Java String toLowercase() and toUpperCase() Methods

1. tolowercase() method

This Java string method converts every character of the particular string into the lower case by using the rules of the default locale.

 

Note: This method is locale sensitive. Therefore it can show unexpected results if used for strings which are intended to be interpreted separately.

 

How to easily Convert String to Integer in JAVA

There are two ways to convert String to Integer in Java,

1.       String to Integer using Integer.parseInt()

2.       String to Integer using Integer.valueOf()

 

What is Hashmap in Java?

A HashMap basically designates unique keys to corresponding values that can be retrieved at any given point.

Features of Java Hashmap

a) The values can be stored in a map by forming a key-value pair. The value can be retrieved using the key by passing it to the correct method.

b) If no element exists in the Map, it will throw a ‘NoSuchElementException’.

c) HashMap stores only object references. That is why, it is impossible to use primitive data types like double or int. Use wrapper class (like Integer or Double) instead.

 

What is Command Line Argument in Java?

Command Line Argument in Java is the information that is passed to the program when it is executed. The information passed is stored in the string array passed to the main() method and it is stored as a string. It is the information that directly follows the program’s name on the command line when it is running.

 

What is this Keyword in Java?

this keyword in Java is a reference variable that refers to the current object of a method or a constructor. The main purpose of using this keyword in Java is to remove the confusion between class attributes and parameters that have same names.

 

Following are various uses of ‘this’ keyword in Java:

It can be used to refer instance variable of current class

It can be used to invoke or initiate current class constructor

It can be passed as an argument in the method call

It can be passed as argument in the constructor call

It can be used to return the current class instance

 

 

Java Memory Management

👉 Lesson 1       Garbage Collection in Java — What is, How it Works, Example

👉 Lesson 2       Java Static Variables — Java Static Method, Variable & Block

👉 Lesson 3       Memory Allocation in Java — Java Stack and Heap Memory Allocation

 

Abstract Class & Interface in Java

👉 Lesson 1       Inheritance in Java — Inheritance in Java OOPs with Example

👉 Lesson 2       Polymorphism in Java — Polymorphism in Java OOPs with Example

👉 Lesson 3       Abstraction in Java — What is, Abstract Class & Method

👉 Lesson 4       Interface in Java — What is Interface in Java with Example

👉 Lesson 5       Interface vs Abstract Class — Know the Difference

 

Better Late than Never

👉 Lesson 1       Constructor in Java — What is Constructor in Java? Program Examples

👉 Lesson 2       Packages in Java — What is, How to Create/Import Package in Java

 

Exception Handling in Java

👉 Lesson 1       Try Catch in Java — What is Exception in Java? Examples

👉 Lesson 2       User Defined Exception — How to Create User Defined Exception in Java

👉 Lesson 3       Java Throws Keyword — Throws Keyword in Java with Example

 

Conditional Loops in Java

👉 Lesson 1       Java for-each Loop — Enhanced for Loop to Iterate Java Array

👉 Lesson 2       Java Switch Statements — Learn Java Switch-Case Statement with Example

 

What is Garbage Collection in Java?

Garbage Collection in Java is a process by which the programs perform memory management automatically. The Garbage Collector(GC) finds the unused objects and deletes them to reclaim the memory. In Java, dynamic memory allocation of objects is achieved using the new operator that uses some memory and the memory remains allocated until there are references for the use of the object.

When there are no references to an object, it is assumed to be no longer needed, and the memory, occupied by the object can be reclaimed. There is no explicit need to destroy an object as Java handles the de-allocation automatically.

The technique that accomplishes this is known as Garbage Collection. Programs that do not de-allocate memory can eventually crash when there is no memory left in the system to allocate. These programs are said to have memory leaks.

Garbage collection in Java happens automatically during the lifetime of the program, eliminating the need to de-allocate memory and thereby avoiding memory leaks.

In C language, it is the programmer’s responsibility to de-allocate memory allocated dynamically using free() function. This is where Java memory management leads.

 

Static Variable in Java: What is Static Block & Method [Example]

The static can be:

Static Variables

Static Methods

Static Blocks Of Code.

Let’s look at static variables and static methods first.

 

What is Static Variable in Java?

Static variable in Java is variable which belongs to the class and initialized only once at the start of the execution. It is a variable which belongs to the class and not to object(instance ). Static variables are initialized only once, at the start of the execution. These variables will be initialized first, before the initialization of any instance variables.

A single copy to be shared by all instances of the class

A static variable can be accessed directly by the class name and doesn’t need any object

 

What is Static Method in Java?

Static method in Java is a method which belongs to the class and not to the object. A static method can access only static data. It is a method which belongs to the class and not to the object(instance). A static method can access only static data. It cannot access non-static data (instance variables).

 

A static method can call only other static methods and can not call a non-static method from it.

A static method can be accessed directly by the class name and doesn’t need any object

A static method cannot refer to “this” or “super” keywords in anyway

 

Java Stack and Heap: Java Memory Allocation Tutorial

What is Stack Memory?

Stack in java is a section of memory which contains methods, local variables, and reference variables. Stack memory is always referenced in Last-In-First-Out order. Local variables are created in the stack.

What is Heap Memory?

Heap is a section of memory which contains Objects and may also contain reference variables. Instance variables are created in the heap

Memory Allocation in Java

Memory Allocation in Java is the process in which the virtual memory sections are set aside in a program for storing the variables and instances of structures and classes. However, the memory isn’t allocated to an object at declaration but only a reference is created. For the memory allocation of the object, new() method is used, so the object is always allocated memory on the heap.

 

The Java Memory Allocation is divided into following sections :

Heap

Stack

Code

Static

This division of memory is required for its effective management.

 

The code section contains your bytecode.

The Stack section of memory contains methods, local variables, and reference variables.

The Heap section contains Objects (may also contain reference variables).

The Static section contains Static data/methods.

Difference between Local and Instance Variable

Instance variable is declared inside a class but not inside a method

 

What is Inheritance?

Inheritance is a mechanism in which one class acquires the property of another class. For example, a child inherits the traits of his/her parents. With inheritance, we can reuse the fields and methods of the existing class. Hence, inheritance facilitates Reusability and is an important concept of OOPs.

 

Types of Inheritance

Inheritance in Java

Java Inheritance Example

Super Keyword

Learn Inheritance in OOP’s with Example

 

Types of Inheritance

Single Inheritance:

In Single Inheritance one class extends another class (one class only).

Multiple Inheritance:

Multiple Inheritance is one of the inheritance in Java types where one class extending more than one class. Java does not support multiple inheritance.

 

Inheritance In Java

Java Inheritance is a mechanism in which one class acquires the property of another class. In Java, when an “Is-A” relationship exists between two classes, we use Inheritance. The parent class is called a super class and the inherited class is called a subclass. The keyword extends is used by the sub class to inherit the features of super class.

 

Inheritance is important since it leads to the reusability of code.

 

What is Polymorphism in Java?

Polymorphism in Java occurs when there are one or more classes or objects related to each other by inheritance. It is the ability of an object to take many forms. Inheritance lets users inherit attributes and methods, and polymorphism uses these methods to perform different tasks. So, the goal is communication, but the approach is different.

For example, you have a smartphone for communication. The communication mode you choose could be anything. It can be a call, a text message, a picture message, mail, etc. So, the goal is common that is communication, but their approach is different. This is called Polymorphism. Now, we will learn Polymorphism in Java with example.

 

Java Polymorphism in OOPs with Example

We have one parent class, ‘Account’ with function of deposit and withdraw. Account has 2 child classes

 

The operation of deposit and withdraw is same for Saving and Checking accounts. So the inherited methods from Account class will work.

 

What is Dynamic Polymorphism?

Dynamic Polymorphism in OOPs is the mechanism by which multiple methods can be defined with same name and signature in the superclass and subclass. The call to an overridden method are resolved at run time.

 

Difference between Static & Dynamic Polymorphism

Static Polymorphism in Java is a type of polymorphism that collects the information for calling a method at compilation time, whereas Dynamic Polymorphism is a type of polymorphism that collects the information for calling a method at runtime.

 

Polymorphism in Object Oriented Programming occurs when there are one or more classes or objects related to each other by inheritance. It is the ability of an object to take many forms.

Method Overriding is redefining a super class method in a sub class.

Dynamic Polymorphism in Java is the mechanism by which multiple methods can be defined with same name and signature in the superclass and subclass.

Static Polymorphism in Java is a type of polymorphism that collects the information for calling a method at compilation time, whereas Dynamic Polymorphism is a type of polymorphism that collects the information for calling a method at runtime.

Super keyword can be used to access methods of the parent class from the child class.

 

What is Abstraction in Java?

Abstraction in JAVA shows only the essential attributes and hides unnecessary details of the object from the user. In Java, abstraction is accomplished using Abstract class, Abstract methods, and Interfaces. Abstraction helps in reducing programming complexity and effort.

 

What is Abstract Class?

ABSTRACT CLASS is a type of class in Java, that declare one or more abstract methods. These classes can have abstract methods as well as concrete methods. A normal class cannot have abstract methods. An abstract class is a class that contains at least one abstract method. We can understand the concept by the shape example in java.

 

Consider the following class hierarchy consisting of a Shape class which is inherited by three classes Rectangle, Circle, and Triangle. The Shape class is created to save on common attributes and methods shared by the three classes Rectangle, Circle, and Triangle. calculateArea() is one such method shared by all three child classes and present in Shape class.

 

 

 

What are Abstract Methods?

ABSTRACT METHOD in Java, is a method that has just the method definition but does not contain implementation. A method without a body is known as an Abstract Method. It must be declared in an abstract class. The abstract method will never be final because the abstract class must implement all the abstract methods.

 

As we all know, the formula for calculating area for rectangle, circle, & triangle is different. The calculateArea() method will have to be overridden by the inheriting classes. It makes no sense defining it in the Shape class, but we need to make sure that all the inheriting classes do have the method.

 

What is Interface in Java?

An Interface in Java programming language is defined as an abstract type used to specify the behavior of a class. A Java interface contains static constants and abstract methods. A class can implement multiple interfaces. In Java, interfaces are declared using the interface keyword. All methods in the interface are implicitly public and abstract.

 

What is Interface?

The interface is a blueprint that can be used to implement a class. The interface does not contain any concrete methods (methods that have code). All the methods of an interface are abstract methods.

 

An interface cannot be instantiated. However, classes that implement interfaces can be instantiated. Interfaces never contain instance variables but, they can contain public static final variables (i.e., constant class variables)

 

What Is Abstract Class?

A class which has the abstract keyword in its declaration is called abstract class. Abstract classes should have at least one abstract method. , i.e., methods without a body. It can have multiple concrete methods.

Abstract classes allow you to create blueprints for concrete classes. But the inheriting class should implement the abstract method.

Abstract classes cannot be instantiated.

Important Reasons For Using Interfaces

Interfaces are used to achieve abstraction.

Designed to support dynamic method resolution at run time

It helps you to achieve loose coupling.

Allows you to separate the definition of a method from the inheritance hierarchy

Important Reasons For Using Abstract Class

 

Abstract classes offer default functionality for the subclasses.

Provides a template for future specific classes

Helps you to define a common interface for its subclasses

Abstract class allows code reusability.

 

What is Constructor in Java?

Constructor is a special method that is used to initialize a newly created object and is called just after the memory is allocated for the object. It can be used to initialize the objects to desired values or default values at the time of object creation. It is not mandatory for the coder to write a constructor for a class.

 

If no user-defined constructor is provided for a class, compiler initializes member variables to its default values.

 

numeric data types are set to 0

char data types are set to null character(‘\0’)

reference variables are set to null

 

 

 

 

Constructor Overloading in Java

Java Constructor overloading is a technique in which a class can have any number of constructors that differ in parameter list. The compiler differentiates these constructors by taking into account the number of parameters in the list and their type.

 

What is Package in Java?

PACKAGE in Java is a collection of classes, sub-packages, and interfaces. It helps organize your classes into a folder structure and make it easy to locate and use them. More importantly, it helps improve code reusability.

 

Each package in Java has its unique name and organizes its classes and interfaces into a separate namespace, or name group.

 

Although interfaces and classes with the same name cannot appear in the same package, they can appear in different packages. This is possible by assigning a separate namespace to each Java package.

 

 

Exception Handling in Java

What is Exception in Java?

Exception in Java is an event that interrupts the execution of program instructions and disturbs the normal flow of program execution. It is an object that wraps an error event information that occurred within a method and it is passed to the runtime system. In Java, exceptions are mainly used for indicating different types of error conditions.

 

There are two types of errors:

Compile time errors

Runtime errors

Compile time errors can be again classified again into two types:

Syntax Errors

Semantic Errors

Syntax Errors Example:

 

Instead of declaring int a; you mistakenly declared it as in a; for which compiler will throw an error.

 

Example: You have declared a variable int a; and after some lines of code you again declare an integer as int a;. All these errors are highlighted when you compile the code.

 

 

Runtime Errors Example

 

A Runtime error is called an Exceptions error. It is any event that interrupts the normal flow of program execution.

Example for exceptions are, arithmetic exception, Nullpointer exception, Divide by zero exception, etc.

Exceptions in Java are something that is out of developers control.

 

Why do we need Exception?

Suppose you have coded a program to access the server. Things worked fine while you were developing the code.

 

Java Exception Handling

During the actual production run, the server is down. When your program tried to access it, an exception is raised.

 

Java Exception Handling

How to Handle Exception

So far we have seen, exception is beyond developer’s control. But blaming your code failure on environmental issues is not a solution. You need a Robust Programming, which takes care of exceptional situations. Such code is known as Exception Handler.

 

In our example, good exception handling would be, when the server is down, connect to the backup server.

 

Java Exception Handling

To implement this, enter your code to connect to the server (Using traditional if and else conditions).

 

You will check if the server is down. If yes, write the code to connect to the backup server.

 

Such organization of code, using “if” and “else” loop is not effective when your code has multiple java exceptions to handle.

 

Summary:

An Exception is a run-time error which interrupts the normal flow of program execution.Disruption during the execution of the program is referred as error or exception.

Errors are classified into two categories

Compile time errors – Syntax errors, Semantic errors

Runtime errors- Exception

A robust program should handle all exceptions and continue with its normal flow of program execution. Java provides an inbuilt exceptional handling method

Exception Handler is a set of code that handles an exception. Exceptions can be handled in Java using try & catch.

Try block: Normal code goes on this block.

Catch block: If there is error in normal code, then it will go into this block

 

What is User Defined Exception in Java?

User Defined Exception or custom exception is creating your own exception class and throws that exception using ‘throw’ keyword. This can be done by extending the class Exception.

There is no need to override any of the above methods available in the Exception class, in your derived class. But practically, you will require some amount of customizing as per your programming needs.

 

Java throws keyword

The Java throws keyword is used to declare the exception information that may occur during the program execution. It gives information about the exception to the programmer. It is better to provide the exception handling code so that the normal flow of program execution can be maintained.

 

Suppose in your java program you using a library method which throws an Exception

If you do not handle the exception in a try catch block, compiling will fail. But almost every other method in the java library or even user defined may throw an exception or two.

Handling all the exceptions using the try and catch block could be cumbersome and will hinder the coder’s throughput.

So java provides an option, wherein whenever you are using a risky piece of code in the method definition you declare it throws an exception without implementing try catch.

 

Summary

The “Java throw keyword” is used to declare an exception. For any method that will “throw” an exception, it is mandatory that in the calling method, you use throws to list the exception thrown.

 

Conditional Loops in Java

👉 Lesson 1       Java for-each Loop — Enhanced for Loop to Iterate Java Array

👉 Lesson 2       Java Switch Statements — Learn Java Switch-Case Statement with Example

 

For-Each Example: Enhanced for Loop to Iterate Java Array

For-Each Loop is another form of for loop used to traverse the array. for-each loop reduces the code significantly and there is no use of the index or rather the counter in the loop.

 

Java Switch-Case Statement with Example

We all use switches regularly in our lives. Yes, I am talking about electrical switches we use for our lights and fans.

 

As you see from the below picture, each switch is assigned to operate for particular electrical equipment.

 

For example, in the picture, the first switch is for a fan, next for light and so on.

 

Thus, we can see that each switch can activate/deactivate only 1 item.

What is Switch Case in Java?

Similarly, switch in Java is a type of conditional statement that activates only the matching condition out of the given input.

Let us consider the example of a program where the user gives input as a numeric value (only 1 digit in this example), and the output should be the number of words.

 

Java Switch statement:

As a standard programming logic, it can simply be achieved by using if…else conditions, but then it will not be optimized for good programming practice nor does the code look readable.

In programs involving more complicated cases, scenarios will not be so simple and would require calling several methods.Switch solves this problem and avoids several nested if…else statements.Also, while using if….else, it is recommended to use the most highly expected condition to be on top and then go ahead in a nested manner.

Some benchmarking tests have proven that in java case of a high number of iterations, the switch is faster as compared to if….else statements.

Points to Note

There is no limit on the number of case java you can have.

Switch java can take input only as integers or characters.

The latest version of Java8 also introduces the much-awaited support for java switch strings statement.

So now go ahead and wire your own switchboard!!

 

 

Java Advance Stuff!

 

👉 Lesson 4       Multithreading in Java — Learn with Examples

👉 Lesson 5       Java Swing Tutorial — How to Create a GUI in Java with Examples

👉 Lesson 9       Groovy Tutorial — Learn Groovy Script Step by Step for Beginners

👉 Lesson 10     Spring Tutorial — What is Spring Framework & How to Install

👉 Lesson 11     Apache ANT Tutorial — What is Apache Ant Build Tool?

👉 Lesson 12     JasperReports Tutorial — What is, How to Install, Report Example

👉 Lesson 13     Kotlin Tutorial — Kotlin Programming [Code example]

 

Multithreading in Java Tutorial with Program & Examples

Any application can have multiple processes (instances). Each of this process can be assigned either as a single thread or multiple threads. We will see in this tutorial how to perform multiple tasks at the same time and also learn more about threads and synchronization between threads.

 

What is Single Thread?

A single thread in Java is basically a lightweight and the smallest unit of processing. Java uses threads by using a “Thread Class”.

 

There are two types of thread – user thread and daemon thread (daemon threads are used when we want to clean the application and are used in the background).

 

When an application first begins, user thread is created. Post that, we can create many user threads and daemon threads.

 

What is Multithreading in Java?

Multithreading in Java is a process of executing two or more threads simultaneously to maximum utilization of CPU. Multithreaded applications execute two or more threads run concurrently. Hence, it is also known as Concurrency in Java. Each thread runs parallel to each other. Mulitple threads don’t allocate separate memory area, hence they save memory. Also, context switching between threads takes less time.

 

 

Java Swing Tutorial: How to Create a GUI Application in Java

What is Swing in Java?

Swing in Java is a Graphical User Interface (GUI) toolkit that includes the GUI components. Swing provides a rich set of widgets and packages to make sophisticated GUI components for Java applications. Swing is a part of Java Foundation Classes(JFC), which is an API for Java GUI programing that provide GUI.

 

The Java Swing library is built on top of the Java Abstract Widget Toolkit (AWT), an older, platform dependent GUI toolkit. You can use the Java simple GUI programming components like button, textbox, etc., from the library and do not have to create the components from scratch.

All components in Java Swing are JComponent which can be added to container classes.

 

What is a Container Class?

Container classes are classes that can have other components on it. So for creating a Java Swing GUI, we need at least one container object. There are 3 types of Java Swing containers.

 

Panel: It is a pure container and is not a window in itself. The sole purpose of a Panel is to organize the components on to a window.

Frame: It is a fully functioning window with its title and icons.

Dialog: It can be thought of like a pop-up window that pops out when a message has to be displayed. It is not a fully functioning window like the Frame.

What is GUI in Java?

GUI (Graphical User Interface) in Java is an easy-to-use visual experience builder for Java applications. It is mainly made of graphical components like buttons, labels, windows, etc. through which the user can interact with an application. GUI plays an important role to build easy interfaces for Java applications.

 

What is a Groovy Script?

Apache Groovy is an object oriented and Java syntax compatible programming language built for the Java platform. This dynamic language has many features which are similar to Python, Ruby, Smalltalk, and Pero. Groovy source code gets compiled into Java Bytecode so it can run on any platform that has JRE is installed. Groovy also performs a lot of tasks behind the scene that makes it more agile and dynamic.

 

Groovy language can be used as a scripting language for the Java platform. It is almost like a super version of Java which offers Java’s enterprise capabilities. It also offers many productivity features like DSL support, closures, and dynamic typing. Unlike some other languages, it is designed as a companion, not a replacement for Java.

 

Why Groovy?

Here, are major reasons why you should use and learn Groovy-

 

Groovy is an agile and dynamic language

Seamlessly integration with all existing Java objects and libraries

Feels easy and natural to Java developers

More concise and meaningful code compares to Java

You can use it as much or as little as you like with Java apps

 

What is Spring Framework?

Spring Framework is an open-source framework for building web applications with Java as a programming language. It is powerful and lightweight yet easy to use, and it provides support for developing Java applications easily. Spring is a lightweight framework which can be thought of as a framework of frameworks because it also offers support for various frameworks such as hibernate, struts, tapestry, and JSF.

 

 

Features of Spring Framework

Now in this Spring tutorial, we will cover some most prominent features of Spring Framework:

Predefined templates

Easy to test

Loose coupling

Lightweight

Fast development

Powerful abstraction

Offers an array of resources

Declarative support

Offers comprehensive tools

 

Spring Framework Architecture

The Spring Framework Architecture provides 20 modules which can be used based on an application requirement.

Spring Framework Architecture

 

The Core and Bean provide the fundamental part of the framework, including IoC and DI.

Core Container

The Core Container is further divided by subcomponents like Core, Beans, Context, and Expression Language modules.

Let see each of these models in detail:

 

Spring Core:

The Core module provides all the primary component of the spring framework. It includes IoC (Inversion of Control) and Dependency Injection features.

 

Spring Bean:

This module offers BeanFactory, which is a sophisticated implementation of the factory pattern.

 

Spring Context:

The Context module builds on the solid base provided by the Core and Beans modules, and it is a medium which helps you to access any objects defined and configured.

 

Spring Expression Languages (SpEL):

 

This module offers expression language for modifying and querying object graph during the runtime.

 

Data Access/Integration:

The Data Access and Integration layer consist of the JDBC, ORM, JDBC, OXM, JMS, and Transaction modules.

 

ORM: ORM module offers consistency/ portability to code irrespective of data access technologies. It will be based on object-oriented mapping concept.

The JDBC module consists of a JDBC-abstraction layer. It helps you elements the need to perform JDBC related coding.

OXM: Object XML Mappers (OCM) helps you to convert the objects into XML format and vice versa.

The Java Messaging Service module offers features like producing and consuming messages.

Transaction: This module offers declarative and programmatic management method for implementing unique interfaces and for all types of POJOs (Plain Old Java Object)

Spring Web:

Web: This module uses servlet listeners and a web-oriented application context. It also offers a feature of web-oriented integration and functionality for multi-part file upload.

 

Web-servlet: This module stores MVC based implementation for web applications.

 

Web-Socket: Module offers WebSocket based and two-way communication between the client and the server in web apps.

 

Web-Portlet: This module is also called Spring-MVC-Portlet module. It offers for Spring-based Portlets and copies all the functionality of a Web-Servlet module.

 

AOP: AOP language is a useful tool which allows developers to add enterprise functionality to the application.

 

Instrumentation: This module offers class instrumentation and loader implementations. It is used for specific application servers.

 

Test: This module provides support for testing of Spring components with TestNG or JUnit tools. It offers consistent loading of Spring ApplicationContexts and caching of those contexts.

 

Spring – MVC Framework

The Spring web MVC framework offers model-view-controller architecture offers components which helps you to be flexible and loosely coupled web applications.

 

The MVC pattern allows you to separate different aspects of the application while offering loose coupling between these elements. Spring MVC also helps you to build flexible and loosely coupled web applications.

 

The MVC design also allows you to separate business logic, presentation logic, and navigation logic. It also offers an elegant solution to use MVC in Spring Framework with the help of DispatcherServlet.

 

How MVC works in Spring?

DispatcherServlet receives a request.

After that, the DispatcherServlet communicates with HandlerMapping. It also revokes controller associated with that specific request.

The Controller processes this request by calling the service methods, and a ModelAndView object returned by the DispatcherServlet.

The view name is sent to a ViewResolver to search the actual View to invoke.

After that, DispatcherServlet is passed to View to render the result.

By using the model data, the View renders and send back result back to the user.

 

Apache ANT Tutorial: What is Ant Build Tool? Example

What is a Build Tool?

A build tool is a programming tool which is used to build a new version of a program. It automates the creation of an executable application from any source code.

 

What is Apache Ant?

Apache Ant is a Java-based command-line tool for building Java applications with the full portability of pure Java code. It allows developers to adopt agile principles and test-driven development to automate the repetitive development tasks like generating documentation, etc. Ant is an acronym for Another Neat Tool.

What is Apache Ant Build tool used for?

Here, are important pros/benefits of using the Build tool:

 

Build tool allows you to automate specific repetitive tasks for like compiling the source code, running software tests, and creating files for the software deployment.

Build tools mostly run without a graphical user interface.

Helps you to convert source code into executable code

Offers an option to recompile a file only if necessary

Allows you to compile numbers of files in a relatively short time

Two widely popular build tools used by Java developers are Apache Maven and Ant.

 

Kotlin Tutorial for Beginners: Kotlin Programming [Code example]

What is Kotlin?

Kotlin is an open-source statically typed programming language that runs on Java Virtual Machine (JVM). It combines Object Oriented Programming (OOPs) and functional programming in unrestricted, self-sufficient, and distinctive platforms. It also allows the twinning of functionalities by miniature codes. Kotlin is a general-purpose programming language which was designed by JetBrains.

Reasons of of using Kotlin

Here, are some important reasons why Kotlin is used widely:

 

Kotlin is a statically-typed language which is very easy to read and write.

Kotlin programs do not require semicolons in their program. This makes the code easy and more readable.

This languare allows exchange and use of information from Java in various ways. Moreover, Java and Kotlin code can co-exist in the same project.

Kotlin’s type system is aimed to eliminate NullPointerException from the code.

It’ll take you less time to write new code in Kotlin. It’s even easier to deploy kotlin code and to maintain it at scale.

Features of Kotlin

Here are a few features of the Kotlin that will make you sure of the progress path of the programming language.

 

Trimmed Coding:

Kotlin is an OOPs-based programming language where code line can be trimmed up to 40 % that which makes Kotlin an ideal choice for software or web development.

 

Open-Source:

Kotlin for Android utilizes JVM and combines the features of OOPs and functional-oriented programming.

Fast Compilation:

it is easy to compile the code when working with Kotlin that results in better performance for android development, and it will also explain which type of data function can be used in the entire code.

 

Extension Functions:

Kotlin can support a variety of extension functions without making any changes to the code. it helps in making existing code more appealing and magnificent for developers.

 

Interoperable:

Kotlin code can be used by Java, and Java codes can be used with Kotlin. So, if you have knowledge about OOPS programming, it is easy to switch to Kotlin’s development. Also, if there are some applications written in Java, then they can be used with Kotlin’s environment.

 

Robust Tools:

Like Java, Kotlin code can also be written using IDE or using the command-line interface. It is easy to work with IDE, and syntax errors are also reduced dramatically. At the same time, when you are working with a command-line interface, code has to be compiled first.

 

Smart Cast:

Smart casting basically helps to cut down the application costs and improves its speed or performance. It works on managing the efficiency of code using type casting or immutable values.

 

 

Java Differences

 

👉 Lesson 1       C++ Vs JAVA — What’s the Difference?

👉 Lesson 2       JDK Vs JRE Vs JVM — Key Differences

👉 Lesson 3       Java Vs C# — 10 Key Differences between Java and C#

👉 Lesson 4       Java Vs Python — What’s the Difference?

👉 Lesson 5       Java Vs Scala — What is the Difference?

👉 Lesson 6       Comparable Vs Comparator — Key Differences

👉 Lesson 7       Kotlin Vs Java — What’s the Difference?

KEY DIFFERENCE:

C++ uses only compiler, whereas Java uses compiler and interpreter both.

C++ supports both operator overloading & method overloading whereas Java only supports method overloading.

C++ supports manual object management with the help of new and delete keywords whereas Java has built-in automatic garbage collection.

C++ supports structures whereas Java doesn’t supports structures.

C++ supports unions while Java doesn’t support unions.

 

What is JDK?

JDK is a software development environment used for making applets and Java applications. The full form of JDK is Java Development Kit. Java developers can use it on Windows, macOS, Solaris, and Linux. JDK helps them to code and run Java programs. It is possible to install more than one JDK version on the same computer.

 

What is JRE?

JRE is a piece of a software which is designed to run other software. It contains the class libraries, loader class, and JVM. In simple terms, if you want to run Java program you need JRE. If you are not a programmer, you don’t need to install JDK, but just JRE to run Java programs. Though, all JDK versions comes bundled with Java Runtime Environment, so you do not need to download and install the JRE separately in your PC. The full form of JRE is Java Runtime Environment.

 

What is JVM?

JVM is an engine that provides a runtime environment to drive the Java Code or applications. It converts Java bytecode into machine language. JVM is a part of Java Run Environment (JRE). It cannot be separately downloaded and installed. To install JVM, you need to install JRE. The full form of JVM is Java Virtual Machine.

 

In many other programming languages, the compiler produces machine code for a specific system. However, Java compiler produces code for a virtual machine which is called as JVM.

 

KEY DIFFERENCES

JDK is a software development kit whereas JRE is a software bundle that allows Java program to run, whereas JVM is an environment for executing bytecode.

The full form of JDK is Java Development Kit, while the full form of JRE is Java Runtime Environment, while the full form of JVM is Java Virtual Machine.

JDK is platform dependent, JRE is also platform dependent, but JVM is not platform independent.

JDK contains tools for developing, debugging, etc. JRE contains class libraries and other supporting files, whereas software development tools are not included in JVM.

JDK comes with the installer, on the other hand, JRE only contains the environment to execute source code whereas JVM bundled in both software JDK and JRE.

 

KEY DIFFERENCE

Java runs on the Java Runtime Environment (JRE) whereas C# is designed to be run on the Common Language Runtime (CLR).

Java is a class-based Object Oriented language whereas C# is Object-Oriented, functional, strong typing, component-oriented.

Java doesn’t support for operator overloading whereas C# provides operator overloading for multiple operators.

Java does not support pointers while C# supports pointer only in an unsafe mode.

In Java, Arrays are a direct specialization of Object whereas arrays in C# are a specialization of System.

 

KEY DIFFERENCES

Java is a compiled+ interpreted Language whereas Python is an Interpreted Language

Java is statically typed whereas Python is dynamically typed

Java has a complex learning curve whereas Python is easy to learn and use

Java is a multi-platform, object-oriented, and network-centric, programming language whereas Python is a high-level object-oriented programming language.

Java takes 10 lines of code to read from a file while Python only needs 2 lines of code.

Java language uses curly braces to define the beginning and end of each function and class definition, whereas Python uses indentation to separate code into separate blocks.

In Java, multiple inheritances is partially done through interfaces, whereas Python supports both single and multiple inheritances.

Java offers limited string related functions, whereas Python offers lots of string related functions.

Java program can run on any computer or mobile device which is able to run the Java virtual machine (JVM) while Python programs need an interpreter installed on the target machine to translate Python code. Compared to Java, Python is less portable.

Java is best for Desktop GUI apps, Embed Systems, Web application services, whereas Python is excellent for scientific and numeric computing, Machine learning apps,more.

Java offers stable connectivity, while Python offers weak connectivity.

 

KEY DIFFERENCE

Scala is a statically typed programming language whereas Java is a multi-platform, network-centric, programming language.

Scala uses an actor model for supporting modern concurrency whereas Java uses the conventional thread-based model for concurrency.

Scala variables are by default immutable type while Java variables are by default mutable type.

Scala supports lazy evaluation while Java doesn’t support lazy evaluation.

Scala doesn’t contain static members whereas Java contains static members.

Scala supports operator overloading whereas Java doesn’t support operator overloading.

Scala doesn’t offer backward compatibility whereas Java offers backward compatibility.

Scala is less readable because of nested code whereas Java is more readable.

Scala frameworks are Play, Lift whereas Java frameworks are Spring, Grails, and many more.

 

KEY DIFFERENCES:

Kotlin combines features of both object-oriented and functional programming, whereas Java is limited to object-oriented programming.

Kotlin allows users to create an extension function while Java doesn’t offer any extension functions.

Kotlin doesn’t offer implicit conversions, and Java supports implicit conversions.

There are no null variables or objects in Kotlin on the other hand, Null variable or objects are part of Java language.

Kotlin doesn’t support static members, while Java uses static members.

In, Kotlin variables of a primitive type are objects while in Java Variables of a primitive type aren’t objects

Kotlin supports Lambda Expression whereas Java doesn’t support Lambda expression. (Lambda expressions are added in Java 8)

Kotlin doesn’t require any variable datatype specifications while Java requires variable datatype specifications.

Kotlin doesn’t require any variable datatype specifications but Java requires variable datatype specifications .

Kotlin programs don’t require semicolons in their program while Java program does need a semicolon.

Language scripting capabilities allow you to use Kotlin directly in your Gradle build scripts while Java does not offer language scripting capabilities.

 

Difference between Comparable and Comparator in Java

What is Comparable in Java?

Comparable in Java is an object to compare itself with another object. It helps to sort the list of custom objects. The java.lang.Comparable interface should be implemented by a class in order to compare its instances. Array of objects implementing a comparable interface is sorted automatically by Arrays.sort and Collections.sort methods.

What is Comparator in Java?

Comparator in Java is an object for comparing different objects of different classes. Comparator interface in Java is also used to arrange the objects of user-defined classes. It includes two important comparator interface methods known as compare (Object obj1, Object obj2) and equals (Object element).

 

 

No comments:

Post a Comment

IT Skills

      Java Technologies Latest Version: Java SE 17, Java EE 8   Spring/spring boot? Microservices? C...