Java Concepts : Part - 01

rahulmishra05

Rahul Mishra

Posted on October 10, 2020

Java Concepts : Part - 01

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.

  1. 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)
  2. 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.
  3. 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.
  4. 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.

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
LinkedIn
Telegram

Other links

GitHub
HackerRank
Instagram

💖 💪 🙅 🚩
rahulmishra05
Rahul Mishra

Posted on October 10, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

Java Concepts : Part - 01
java Java Concepts : Part - 01

October 10, 2020