Saturday, September 17, 2022
HomeEducationProgramming LanguageBasic Introduction To Java Programming Language

Basic Introduction To Java Programming Language

1. What is Java?

Java is a programming language. Java is a high-level robust, object-oriented, and safe programming language.

In 1995, Sun Microsystem created Oak, but Oak was already a registered company, so he changed the name to Java.

Now, Java is one of the most popular programming languages.

2. Why do we use Java?

  • Java is compatible with a variety of platforms (Windows, Mac, Linux, and Raspberry Pi, among others.)
  • A large massive community of support.
  • It is a safe and efficient programming language.
  • It is among the most used programming languages around the globe.
  • It is simple to master and easy to make use of
  • It is free and open-source.
  • Permits code reuse which reduces development costs.

3. What are the applications of Java

Sun estimates that Java is used by 3 billion devices. Java is used on many devices. These are some of the devices where Java is currently used:

  1. Desktop applications such as media player, antivirus, acrobat reader, and the media player are all available.
  2. Web Applications like irctc.co.in
  3. Enterprise Applications, such as banking applications.
  4. Mobile
  5. Embedded System
  6. Smart Card
  7. Robotics
  8. Games, etc.

4. Features Of Java

Basic Introduction To Java Programming Language
Compilation Flow of Java

The primary objective of Java is to create an easier, portable, and secure programming language that every person can learn very easily. Some important features of java are:

  1. Platform Independent: It can be executed on multiple platforms like Windows, Mac OS, Linux, etc. Java code is compiled by the compiler before being transformed into bytes. It is a platform-independent code since it can be executed on multiple operating systems, i.e., Write Once and Run Anywhere.
  2. Object-Oriented:  Object-oriented refers to the way we arrange our software using a variety of objects that include both data and behavior.

Object-oriented Programming (OOPs), a method that makes software development and maintenance easier by providing some rules, is called object-oriented programming.

The basic Concepts of Opps are:

  • Class
  • Object
  • Inheritance
  • Polymorphism
  • Abstraction
  • Encapsulation

3. Secured: Java can develop a virus-free system as it is secure because Java programs run inside a virtual machine sandbox.

4. Portable: Java is portable because you can carry the Java bytecode to any platform. It doesn’t need any implementation.

5. Multi-Threading: A thread can be thought of as a separate program that executes concurrently. Multiple threads allow us to create Java programs that can handle multiple tasks simultaneously. Multi-threading has the advantage that each thread doesn’t take up memory. It shares the same memory area. Threads are essential for multi-media and Web applications.

6. Dynamic: Java is a dynamic language. Java supports the dynamic loading of classes. This means that classes can be loaded at will. It supports functions in its native languages, C and C++.Java support automatic memory management and dynamic compilation (garbage collection).

5. Java Installation

Some Systems already have java so first, we need to check by entering the command in the command prompt: ( java –version )

Basic Introduction To Java Programming Language
Command of Java version

Note: If you get the above output and get the version then the below steps didn’t need to be executed.

For running a java program, we must download some things, the requirements are:

  • Download an IDE like Eclipse, IntelliJ, Visual Studio Code, etc.
  • Download and Install JDK (Java Development Kit)
  • Then set the path in your system of JDK/bin directory.

6. First Java Program

Basic Introduction To Java Programming Language
Hello World: Java First Program

Parameters used in the first program

Let’s see what is the meaning of class, public, static, void, main, String[], System.out.println().

  • class keyword can be used to declare a Java class.
  • public Keyword is an access modifier that indicates visibility. This means that it is visible to everyone.
  • static can be a keyword. Any method that is declared static is called the static method. The main advantage of the static methods is that you don’t need to create objects to invoke them. Because the main() function is executed by JVM, it doesn’t need to be invoked with an object. It saves memory.
  • void indicates the return type for the method. This means that it doesn’t return any value.
  • main is the start point of the program.
  • String[] or string args[] are used to specify command-line argument It will be discussed in the next section.
  • System.out.println() can be used to print a statement. Here, System is a class. Out is an object of PrintStream. Println() is a method from the PrintStream. In the next section, we will talk about the internal workings of System.out.println().

7. Identifiers

A name in a Java program is called the identifier, it can be a class name or method name or label name.

Rules of Identifiers

  • Valid identifiers can include letters, digits and underscores.
  • An underscore or a letter should be the first letter of any identifier.
  • Keywords like int or while cannot be used. as identifiers.
  • There is no limit on the length of an identifier. If the identifier exceeds 31 characters, some compilers may not be able to interpret it correctly.

8. Variable

Variables can be used to store data values.

There are many types of variables in Java.

  • String– Double quotations enclose stores text such as “Hello” String values
  • int stores integers (whole numbers), without decimals such as 123 and -123
  • floating stores floating-point numbers with decimals such as 19.99 and -19.99
  • char stores single characters such as a or b. Single quotes surround char values
  • Boolean- Stores values with two states: true/false

Types Of Variable

  • Local variable
  • Instance variable
  • Static variable

9. Data Type

Data types describe the sizes and values of variables that can be stored. Java has two data types:

1. Primitive Data Types: These primitive data types are boolean and char, byte short, int long, float, double.

2. Non-primitive Data Types or Derived: These non-primitive types are Classes and Interfaces. Arrays.

3. User-Defined Data Type

  1. Java Primitive Data Types

Primitive data types in Java language are the foundation of data manipulation. These are the basic data types in Java Language.

There are 8 types of primitive data types:

  • boolean data type
  • byte data type
  • char data type
  • short data type
  • int data type
  • long data type
  • float data type
  • double data type

2. Java Non-Primitive Data Types

A reference type is also called Non-primitive data types

  • The primary difference between non-primitive data types and primitive is:
  • Java already defines primitive types. Java does not define non-primitive types.
  • Methods can be called by non-primitive types, but primitive types cannot.
  • A primitive type always has a value, while nonprimitive types can be NULL.
  • Primitive type begins with a lowercase letter. Non-primitive types start with an uppercase letter.
  • Primitive types are smaller than non-primitive ones.

Strings, Arrays, Classes, and Interfaces are some examples of the non-primitive type.

Read More:

Who can get a V badge from Free Fire Partner Program?

SEO Copywriting Guide, Top 5 SEO Copywriting Tips

5 Most Operative SEO Tips For 2022

TCS Off Campus Hiring for YoP 2020, 2021 & 2022

Top 10 Best alternatives for Amazon 2022

Ruchika
Hello, My name is Ruchika and I am a Full Stack Developer from Delhi. I am final year Computer Science student from SLIET University. My technologies are Nodejs, React, MongoDB, and I am also familiar with Python, C, and C++. Apart from technical skills, My hobbies are reading, writing, and traveling. I consider myself a very focused person and I always work towards my goals in a very efficient manner. I am a team player and very optimistic in tough times.
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -

Most Popular

Must Read

Top 10 Free 2022 Movies

Top 10 Free 2022 Movies to be released in 2021 and 2022 by Netflix, Marvel, HBO, and many more. This article will give you...
amazon ads