Java Programming

JAVA PROGRAMMING BASICS

Java is the base language for other programming languages. Java is used in many sectors of app development like website, Android app development, standalone applications and embedded systems.

In this article, we will get to know basics of java programing. Java is one of the most popular and widely used programing language.

Java Introduction:

In this article, we will go through features and uses of java programming. We will see how we can set PATH variable to run java program. And finally, we will discuss about a sample java program.

What is Java?

Do you know, what is Java? Java is a hugely popular programing language based on object-oriented concepts. Java is a fast, secure and one of the base language choices for Android programming. It is a class based; object-oriented programing language designed for application development. Writing java code using objects provides advantages in programming, like the ability to hide what’s going on ‘inside’ the object from other programmers. Java platform includes a compiler, an execution engine and set of libraries. API libraries help developers to re-use the available code in the library.

Overview of Java:

Java is not too difficult to learn as it has small set of keywords and syntaxes. Java eliminates many complex concepts of C++. Java garbage collection is the process by which Java programs perform automatic memory management. Java programs run on the JVM. garbage collector finds unused objects and deletes them to free up memory. In Java, everything is represented as objects. An object is kind of wrapper that encapsulates data and its behavior. The programs written in Java are platform-independent and uses Write once, run everywhere principle. James gosling initiated the Java language project in 1991 along with a small team of engineers and released it in 1995.

Features of Java:

Java programming language is very simple and easy to learn, understand, and code. It supports all the features of the object-oriented programming. Portability is one of the core features of java which enables the java programs to run on any computer or operating system. Java supports multi-threading programming, which allows to write programs that do multiple operations simultaneously. Java is more robust because the java code can be executed on a variety of environments, java has a strong memory management mechanism called garbage collector.

Uses of Java:

Desktop applications can be easily developed using Java. We can use APIs like AWT, Swing to build these applications. A mobile application is an application created for mobile phones and tablets. In today’s world, majority of phones and smart devices have Android OS. Android development is not possible without Java. Java Micro Edition is used to build applications that run across all feature phones and smartphones. Embedded systems use Java for development. Originally, Java was designed for the purpose of developing embedded systems.Android games use Java as a primary language to run on the Android platform.Java is quite popular in some parts of robotics.

JDK Installation:

For JDK installation, please check below link:

https://www.oracle.com/in/java/technologies/javase-downloads.html

Set Path in Java:

  • To run java program from any directory, we need to set the path.
  • For windows, Open properties in My Computer after that
  • From advanced tab navigate to Environmental variables
  • In the new tab of user variable, write path in variable name.
  • In variable value of ‘path’, copy java bin folder location and press ok.
  • In Linux OS we need to use export command
  • Set PATH with the JDK bin directory location.

Demo Program:

Let’s start to create a Source Code for your Program. First Declare a class with name First program. Then, declare the main method public static void main(String args[]){

Type the System.out.println(”This is my First program"); which displays the text This is my First program. Your class name and file name would be same. Please note,Java is case sensitive Programming language. Save the file as FirstProgram.java. To run program from command line, open the command prompt. Compile the code using command, javac FirstProgram.java. To execute the program, type java FirstProgram

Lesson Intro Video

(Next Lesson) JAVA PROGRAMMING,OBJECTS & Classes
Back to Java Programming

No Comments

Give a comment