Java Concepts : Part - 01
Tags: java, codenewbie, bash, computerscience
Published: 2020-10-10 22:22:31

**Whenever there is a discussion on different programming languages, you will come across many programming languages like Python, C, C++, Java, JavaScript etc. Now, if you want to learn any programming languages, what should you learn ? That's a very confusing question.**

**Today in this article you will get an introduction to Java Prograaming language.**

_This is a 12 part series, so make sure to check other parts also._

## About Java
In the beginning the name of Java was **Oak** (_inspired by the plant oak_),  and then later it was converted to **Java** (_Java is the name of an island in Indonesia, at that time it was one of the heights producer of coffee._)
Java was originally designed for interactive television, but it was too advanced for the digital cable industry at that time.
Java is a class based, object oriented programming language (_OPPs_), there is one more feature which makes Java a special and different programming language from the others, and that is it is a **Platform independent language** which means that you can _write once, and run anywhere (WORA)_ your code, you can write your code on one machine and then can run it anywhere there is no need for recompilation.

This was an basic introduction to Java now let's see some concepts of Java.

1. **Java programming paradigms :-**

   - _Encapsulation :-_ In object-oriented programming languages, the notion of encapsulation refers to the bundling of data, along with the methods that operate on that data, into single unit. Many programming languages use encapsulation frequently in the form of classes.
    
   - _Inheritance :-_ Inheritance is a mechanism in which one object acquires all the properties and behaviours of parent object. It is an important part of **OOPs** (_object-oriented programming_)
    
   - _Information Hiding :-_ The concept of **information hiding** was first described by **Parnas** (_1971) who suggested that access to information should be restricted to reduce the interconnectedness of a system. He proposed that this would facilitate splitting of a system into two modules while maintaining a user-friendly external interface and allowing implementation details to be changed without affecting clients.
    
   - _Polymorphism :-_ Polymorphism is the ability of an object to take on many forms. the most common use of polymorphism in OPP occurs when a parent class reference is used to refer to a child class object. Any java object that can pass more than one IS-A test is considered to be **polymorphic.**

2. **There are total 9 pacakges in Java programming languages :**
   - **java.applet :-** For applet programming.
   - **java.awt :** The **Abstract Windowing Toolkit** for designing GUI like Button, Checkbox, Choice, Menu, panel, etc.
   - **java.io :** File input/output handling.
   - **java.lang :** Provides useful classes like to handle object, thread, Exception handling, System, math, Float, Integer etc.
   - **java.net :** Classes for _Network Programming_ supports TCP/IP networking protocols.
   - **java.util :** It contains miscellaneous classes like Vector, Stack, List, Date, Dictonary, Hash, etc.
   - **java.sql :** For database connectivity (JDBS)

3. **Java programs are availabe in two flavours :**
    - **Applet :** A Java applet is a program that appears embedded in a web document and applet come into effect when the browser the web page.
    - **Application :** It is similar to all kind of program like in C, C++, Python etc. to solve a problem.

4. **Basic methods in applet :**
    - **public void int() -** To intialize or pass input to an applet.
    - **public void static() -** The start() method is called after the init(), method it starts an applet.
    - **public void stop() -** To stop a running applet.
    - **public void paint (Graphics g) -** To draw something within an applet.
    - **punlic void destory() -** To remove an applet from memory completely.

5. **Application v/s Applet :**
    - Applet do not use `main()` method for intializing the execution of code. Applets, when loaded, automatically call certain methods of Applet class to start and execute the code in applet.
    - Unlike application (stand alone), applets cannot be run independently. They are to be embedded in `HTML` pages, an applet code which browser can run.
    - Applet cannot read from or write to a file in the local computers.
    - Applet cannot communicate with other servers in the networks.
    - Applet are restricted from using libraries from other languages, such as C, C++, etc.

If you want to see some code related on these topics then you can go the given link\
[Link of the code file.](https://github.com/rahulMishra05/Blog/tree/main/Post03/Demonstration01)

_Just follow the readme file, to know more_

> Hope this article helped you, if you have any doubt or query regarding anything realted to this topic, then please feel free to contact me.

### Contact Me

[Twitter](https://twitter.com/r_mishra10)
[LinkedIn](https://www.linkedin.com/in/rahul-mishra-66210b185)
[Telegram](https://t.me/rahul_mishra10)

#### Other links

[GitHub](https://github.com/rahulMishra05)
[HackerRank](https://www.hackerrank.com/rahulmishra10201)
[Instagram](https://www.instagram.com/rahul_mishra10/?hl=en)