Java Tutorial For Beginners | Session 1: Introduction To Java & Development Environment Setup

Hello Everyone, If you are the first time visitor of my channel then a very warm welcome to you. And if you are already a subscriber of
Screenmate then welcome back. Thanks for your support, and I will keep coming up
with variety of videos for you on traveling vlogs, food, entertainment and
technical sessions. Do like comment and share my videos with your friends and
family and most importantly please subscribe to my channel which will
motivate me to publish lots of content for you, thank you. This is the very first
session of Java where I will give you a brief introduction on it. This Java series
will cover all the topics from basic to advanced Java along with program
examples. Approximately 50+ sessions will be released as part of this course.
So stay connected with Screenmate and you will get every Monday a new session
as part of Java series. So before starting the session, let me introduce
myself. Who am I? I’m Rajesh a software
professional. I have seven plus years of experience in IT industry. At present I
am working with an MNC as a team lead in a telecom project. I have designed and
developed a couple of Web Portals, develop multiple applications using
different tools and technologies. I have coached and trained my colleagues and
friends over technologies, different programming languages and multiple tools.
Through this video series of sessions, I am going to share my knowledge in Java
with you all. I will try to keep my sessions detailed and more explanatory
and practical so that it benefits you in a better way and I hope you all will
follow my videos and stay connected. let’s start the very first session of
Java which will be the introductory session. Today we are going to cover four
topics as part of session one. First will be the introduction of Java where I will
talk about what is Java, history of Java, features of Java and where Java is being
used these days and as part of the development environment setup, I will
show you how to install Java in your windows machine.
Re-installation of Java in case Java is already installed in your Windows
machine but it is not working as expected. In that case how you will
uninstall Java completely from your machine and reinstall it. And finally the
last topic will be installing eclipse on your machine so that you can write and
practice the java programs. Now let’s talk about what is Java? Java is a
programming language and a computing platform. Most of the Java syntax are
derived from C and C++ programming languages, and Java is a case sensetive
programming language. Java was designed to have the look and feel of the C++
programming language but is simpler to use and enforce an object-oriented
programming model. Java can be used to create complete applications that may
run or a single computer or be distributed among servers and clients in
a network. It can also be used to build a small application model or applet for
use as part of a webpage. When a programmer writes a java application the
compiled code which is known as bytecode runs on most operating systems including
Windows Linux and Mac operating systems. Java is an independent programming
language that follows the logic of write once run anywhere, that is the compiled
Java code can be run on all platforms which supports Java. Now let’s talk about
the history of Java. In the year 1991 James Gosling Mike Sheridan and Patrick
Naughton initiated the Java language project at
Sun Microsystems. The small team of Sun engineers called Green Team. It was
originally designed for small embedded systems in electronic appliances like
set up boxes televisions etc. Initially it was called green team by
James Gosling and the file extension for it was .GT. After that
it was called Oak and it was developed as part of green project. Since the team
wanted a revolutionary, dynamic, lively, cool, unique and easy to spell and fun
to say name, so in 1995 they collectively decided and renamed the oak as Java. On
23rd January 1996 JDK 1.0 was released. And now Sun Microsystems is a subsidiary
of Oracle Corporation. Now let’s talk about what are the different features of Java?
Then I will cover each and every feature separately in coming slides Java is a
simple programming language. Java is an object oriented programming language. Java is
platform independent. Java is portable. Java is secured. It is robust. Java is an
interpreted programming language. Java is architecture neutral. High performance is
one of the most important feature. Java supports multi-threading. Some of the
other important feature of Java are distributed and dynamic. Now let’s talk
about each of the Java features in detail. Let us talk about the very first
feature of Java that is simple. Java is very easy and simple to learn as most of
the syntax are derived from c++, hence anyone having the knowledge of C++ can
easily understand the syntax and by going through the program one can easily
understand what is going on in the program. Also Java has removed many
complicated and rarely used features like operator overloading explicit
pointers etc. Also in Java we do not require to manage the memory allocation.
Java garbage collector automatically removes
unreferenced objects and take care of the memory allocation. Second feature of
Java is object oriented. So Java is an object-oriented programming language
because we deal with everything in Java using objects. Now what does the
object-oriented means? We organize our software as a combination of different
types of objects that incorporates data and behavior both. OOPs
is a methodology which simplifies software development and maintenance by
providing some rules. Some of the basic concept of object oriented programming
are object, class, inheritance, abstraction, polymorphism and encapsulation. In my
coming videos I will briefly talk about these terminologies. Next feature of Java
is portable. Java is portable because it facilitates us to carry Java bytecode to
any platform. Java program produces identical result regardless of the
underlying CPU operating system or Java compiler and also it does not require
any implementation. Next one is platform independent. Java is platform independent
programming language which means we write code once and execute the same in
different platforms where they provide the hardware or software environment in
which program runs. Java code is compiled by the compiler and converted into
bytecode. This bytecode is a platform independent
code because it can be run on multiple platforms and also Java provide a
software based platform that runs on the top of other hardware based platforms. It
has two components, first one is Runtime environment which is called JRE and the
second one is application programming interface. The most important feature of
Java is Secured. In Java there is no concept of pointers which means by not allowing
pointers, Java provides another level of abstraction to
the developer. No pointer support make Java more secure because the point to
memory location or used for memory management that losses the security as
we used them directly. Second point is bytecode verifier. It checks the code
fragment for illegal code that can violate access right to objects. Also class
rotor in Java is a part of the JRE which is used to load Java classes into the
java virtual machine dynamically. It adds security by separating the package for
the classes of the local file system from those that are imported from
network sources and security manager determines what resources a class can
access such as reading and writing to the local disk. Java program run inside
virtual machine sandbox if you see in the diagram the comparison between C++
and Java, C++ application uses the runtime environment of its own operating
system whereas Java application uses its own runtime environment which is Java
Virtual Machine. Next feature is robust. Now what does robust
means? Robust means strong. There are several reasons why we call JAVA robust.
First of all there is a lack of pointers that avoids security problem. It has a
very strong memory management technique. There is automatic garbage collection in
Java which runs on the Java Virtual Machine to get rid of objects which are
not being used by a java application anymore.
There are also exception handling and the type checking mechanism in Java. All
these points make Java robust. Next important feature of Java is
architecture neutral. Java is architecture neutral because there are
no implementation dependent features for example size of primitive type is
fixed. In C programming integer datatype occupies two bytes of memory
for 32-bit architecture and four bytes of memory for 64-bit architecture.
However it occupies 4 bytes of memory for both 32 and 64-bit architecture in
Java. Now let’s talk about the next feature of Java which is interpreted. The
Java compiler generates byte codes rather than native machine code to
actually run a Java program you use the Java interpreter to execute the compiled
byte code. Java byte codes provide an architecture neutral object file format.
The code is designed to transport program efficiently to multiple
platforms. Software author is protected since binary byte streams are downloaded
and not a source code. Java is faster than other traditional interpreted
programming languages because Java bytecode is close to native : Java is an
interpreted language that is why it is slower than compiled languages like C
and C++. Java code is compiled into byte code which is highly optimized by the
Java compiler so that the Java Virtual Machine can execute Java applications at
full speed. In addition compute-intensive code can be rewritten
native code and interfaced with Java platform with a Java native interface
thus improved the performance. Next very important and useful feature of Java is
multi-threading. A thread is like a separate program executing concurrently.
We can write Java programs that deal with many tasks at once by defining
multiple threads. The main advantage of multi-threading is that it doesn’t
occupy memory for each thread. It shares a common memory area. Threads are
important for multimedia web applications etc. Distributed, this is
also one of the best feature of Java. Java is distributed because it
facilitates users to create distributed applications. In Java RMI and EJB
are used for creating distributed applications. This feature of Java makes
us able to access files by calling the methods from any machine on the Internet. Now the last feature we have is dynamic.
As we have discussed a Java source program compiles into byte code, this
byte code is stored in a file with the extension .class. Running Java
application can load a compiled time unknown .class file, understand the
defined class, instantiate it and use it for its own purpose. This process is
called introspection and reflection. In Java a running Java program can
introspect an unknown class, understand the attributes and operations defined in
it. Create an instance of the class. Set their attributes of the created object and
invoke the member functions on the created object. it can also create an
array of objects of this unknown type at runtime. This is the dynamic nature of
Java. Now let’s see where Java is used these
days. Java is used for various application development like desktop
application, web application, Big Data, real time software, enterprise
application, operating system, banking applications, scientific and robotic
applications, video games, embedded systems, computer games, Android
applications, retailing and e-commerce applications, research and development,
cryptography, web and application service. Aalso there are lots of big companies
using Java like Airbnb, uber, big data, trivago, Myntra, Flipkart, Spotify, Infosys,
Philips, Google, Accenture, Thomson, ibibo, okta, eBay, better cloud, stack, Symantec,
Intel and many more. Now as you are aware of the overview, history, feature and uses
of Java, let’s move to our next segment where I will show you how you can
prepare your system to write your very first code. The very first step is
installing Java in your machine if Java is not installed already. First of all we
will check whether Java is installed in the system or not. For this we will open
command prompt and type Java dash version commander. If we get a message
saying Java is not recognized as an internal or external command, it means
Java is not installed, to be double sure we will type Javac command and press
ENTER, if we get the same message again it means Java is not installed in our
system. Now let’s come out of command prompt by entering exit command. Now open
your favorite browser in my case I’m opening Chrome and search
for Java JDK. The first link which you will get as
part of search result will be from Oracle website so click on the link, it
will take you to the Oracle website from where you can download JDK. First you need to accept the terms and
conditions then you will get a list of JDK installer based on different system
specifications. You have to download JDK for your
machine based on the configurations. To check this we will open my computer
right click on empty place and click on properties here we can see that system
is a 64-bit Windows machine so we will download the 64-bit windows jdk from the
website. As you can see that the download has
been started. As you can see the download has been
completed. We will go to the folder where the downloaded file is. Now we will right
click on the file and click on run as administrator and follow the on-screen
instructions. Now you can see the installation is
completed. After installation you will see a Java folder in c program files and within that folder you will see two
folders JDK and JRE. Now we need to set the environment variable so for this
open my computer right click on empty place and click on properties. And then click on advanced system
settings. Click on environment variable. Where you can see the list of all other
environment variables. Now here we have to set the path of JDK and JRE. For this
click on new button and paste the JDK location till the bin folder. similarly copy the location of the JRE
folder till the bin folder and paste the path in the environment variable. Under system variable click on the path
variable, you will get a new window here you have to type JAVA_HOME in
capitals under the variable name and in variable value you need to give JDK
folder path. click okay and come out of the window. Now we will open command prompt and type the Java commands. Java – version and Javac commmds. As you can see this time we are getting
the proper response from the commands which shows that Java 1.8 has been
successfully installed in our system. Nnow let’s move to our next segment where I will show you how you can uninstall Java completely from a system in case
Java is not working properly and you want to reinstall it again. Please watch
this segment carefully and follow the instructions. Now we will open command
prompt and type the Java commands Java – version and Javac commands. As you can see this time we are getting
the proper response from the command. you can say that the Java is available in
this machine, now I will uninstall it. For this we will go to control panel and
uninstall the two Java programs. as you can see in my screen So now both the programs are installed
we will verify the uninstallation by going to command prompt and type Java
-version command. As you can see that we are getting the
message as Java is not recognized as an internal or external command which means
Java has been uninstalled from the system. But as I mentioned I will show
you how you can completely remove Java from your machine, so that you do not
face any problem when you reinstall it. If you leave it here there might be
chances of facing issues post re installation. So now let’s go to
Program Files and make sure there shouldn’t be any folder named as Java. It
is fine. There are no such folders. Now open run command window and type Appdata and click on OK. you will get three folders local, local
low, and roaming, you have to make sure in these three folders there shouldn’t be
any folder with the name SUN, if you find such folder just delete it. Again open run application and type regedit that is regedit. Go to hg current user and within that go to software
folder and make sure there shouldn’t be any folder named java. Same verification
you need to perform for the H key local machine folder. Now we will perform the final check in
command prompt by entering the Java commands. Now we can see that Java has
been completely removed from the system. Now you can reinstall Java in your
machine by following the instructions given in the previous installation
segment in this video. Now let’s move to our next segment which is how you can
install the Eclipse editor in your system so that you can write and
practice new Java programs. Open Chrome or any other browser you
want. Type Eclipse, you need to click on very
first link which will be from Eclipse official website. Click on the download
button the download will start immediately. Open the folder where the Eclipse
Installer has been downloaded and double click on that and follow the
instructions. Now you can see that the installation is
completed. We will launch eclipse now. For now we will go with the default
workspace location which is appearing here. Don’t worry I will talk about these
in detail in my coming videos. The initial configuration is in progress,
give it some time to complete. You can see that eclipse is opened and a
default project has been provided to you. You can create here as many as project
you want. we have reached to the final segment of the video where we will write
a simple program to make sure all the installations are done successfully, and
we are ready for the Java coding, We will use the default project which we got as
part of the Eclipse installation. Right click on the folder src/main/Java and
click on package. I will give the package name as Java
code. Now right-click on the package and click
on new and then click on class. I will give the class name as first program. Select the public static void main check
box and click on finish. I will write a simple message and execute the program. Now if I run this code I will get some
output. So as you can see that we have got the output as expected which we have
mentioned in the program. We have reached to the end of the video. thank
you for watching the video. In next session as mentioned earlier in this
video I will talk about the object-oriented programming concepts. I
will show you how you can create a project and basic structure of a Java
program. Thanks for watching the video. If you
liked the video please like comment and share the video and do subscribe to my

Leave a Reply

Your email address will not be published. Required fields are marked *