Wednesday 21 August 2019

Java VS Javascript - Difference between java and JS

Java vs Javascript


java vs javascript



What is Jscript?


JavaScript(JS or JScript) is a client side programming language used to add programming logic to web pages. This is how you can understand it. HTML is a designing language and it only designs web pages. You cannot perform any logic in web pages through HTML. For example, when the user clicks on the link, you want to perform some processing by calling a function. But you cannot do this through HTML, because HTML is used only to design web pages. For this you need a programming language.

Dynamic web page in Javascript

JavaScript is a similar programming language that adds logic to web pages and makes them dynamic. It was developed by Sun Micro Systems. It was earlier named Live Script which was later changed to JavaScript. JavaScript has object oriented programming capabilities. It is defined in the head section of the HTML file. You cannot perform any calculations with HTML if you do not use JavaScript. You can also perform validation with JavaScript. JavaScript is a programming language that browsers understand and is used exclusively for web pages.

Features of JavaScript


There are 2 important features of JavaScript, which are given below.

Dynamic

JavaScript is able to generate dynamic web pages. JavaScript is capable of making changes in the web page as soon as it is loaded. While loading web pages, it can be decided what task to perform. While this does not happen in HTML, all the actions are already defined in it and you cannot take any action in the load time of web pages generates HTML static pages. But JavaScript generates dynamic pages. For example, the JavaScript page can show weather according to your location while loading.

Client Side

JavaScript is a client side scripting language. Any execution in PHP is performed on the server. But not so with JavaScript. When you use JavaScript, any execution is performed on the client side. For example, validation in JavaScript is performed in the web browser on the client side. But validation in PHP is performed on the server because of this JavaScript reduces the load of the server.


Advantages of javascript 

Javascript is fast

JavaScript is very fast due to being client side. Because it does not waste time in establishing connection to the server. JavaScript executes without connection to the server.

JavaScript is cross platform

JavaScript runs smoothly on any browser and operating systems without any problems. All latest browsers support JavaScript by default.

Javascript works with multiple languages

JavaScript can easily work with other languages. Such as HTML, CSS and PHP etc.

Javascript is Simple

JavaScript is a very simple language. Anyone can learn and implement it easily.


Disadvantages of JavaScript


Apart from the advantages, there are also the disadvantages of JavaScript which are given below.

Less secure

The code of JavaScript executes on the client side, so some viruses can come in it. Because of this JavaScript is not considered to be very secure.

Execution Vary

JavaScript gives different results on different browsers. But this is not the case with server side scripting languages. The server side script always returns the same result, regardless of the browser.

No Support for Network Applications

JavaScript cannot work with network applications because there is no support available in JavaScript for this.

Functions of JavaScript

  1. JavaScript is used to create dynamic web pages.
  2. Highly interactive web pages are created from this.
  3. By performing validation on the client side via JavaScript, you can reduce the load of the server.
  4. With this you can solve many problems related to browser.
Thats all we have for JS, Now let us discuss what is java and what is difference between java and javascript.


 JAVA



 History of Java


Java is a general purpose object oriented programming language. Sun microsystems java 1991 Was made in Earlier java was named oak but later it was changed to java. Java was developed by James Gosling. Java was primarily developed to make consumer electronics such as TV, VCR etc. software.
The most important and popular feature of Java was that the java platform was independent. Because java was not made for any particular hardware or operating system. Therefore programs created in java can be executed on any system. This feature of Java makes java the most popular language even today.

Features of Java


Java has many features. To become a good java programmer, you should know all these features. Let's try to learn about some popular features of java.

Compiled and Interpreted


Most programming languages ​​are either compiled or interpreted. But java combines these two approaches and creates a two stage system. First, java compiler your program and generate byte code.

Byte code does not contain machine instructions. Therefore java generates machine code by interpreting bytecode in the second stage, which can be executed directly.

Java is platform independent

Makes Java bytecode platform independent. When you compile a java program, it is converted into byte code. This byte code cannot run on any machine or operating system. It only runs on JVM (Java Virtual Machine).

To run Java's program, you have to install JVM on your operating system. There is a separate JVM for each operating system but all do the same. And that is to convert bytecode into machine code for that operating system.

So the bytecode generated by the JVM of one operating system can be run on any other JVM. And then the JVM generates machine code for that operating system. So different machine code is generated for different machines but it is generated from the same byte code because your program is first converted to byte code.

Java is object oriented

Java is a true object oriented programming language. Almost everything in Java is object. Java stores all information as objects.

Robust and Secure

If we talk about user experience then java is a robust language. Any program created in Java can work in different environments with different technologies without crashing. Its programs never crash. It is very reliable language. Security in Java is provided by JVM. The machine detects invalid combinations by running some tests on the JVM before generating the code.

Distributed

From Java you can create distributed applications. Distributed applications are applications that are on different networks. And perform the task together. Through RMI in Java, you can interact with the applications available on other networks.

Simple and famous

Java is a simple language. Many features of Java are derived from c and c ++. Java's syntax is similar to c and c ++. Such as variable declarations, control statements and method declarations etc. All these make java easy to understand. Because java is designed with c and c ++ in mind, it seems familiar to most programmers.

Multi-threaded and Interactive

By default java is a multithreaded language. Any java program can complete many tasks simultaneously. This feature makes java fast and interactive.

High performance

When it comes to performance, the performance of java is very impressive. Java's speed is the main reason byte code. The architecture of Java is designed in such a way that the overhead at junta is very low.

Dynamic and Extensible

Java is a dynamic language. Java is capable of dynamic linking from libraries, methods and classes during run time. Therefore java can be used easily with new technologies.

Ease of Development

Developing programs in Java is very easy. Java provides you with built-in libraries which contain important classes for your use. This reduces the overhead of the programmer. The programmer can easily develop software by accessing these libraries.

Object Oriented Principles of Java

As I told you java is an object oriented language. Java also follows object oriented principles like all object oriented programming languages. Let us try to learn about these principles.

Encapsulation

Encapsulation is also called data hiding. In encapsulation you declare private variables. And access them through public methods, your variables can be accessed by methods of your own class.
No other class can access your variables. In this way, you also hide and use the data. Another means of encapsulation is to bind data and code to a unit and prevent access from outside


Thats all we have for difference between java and javascript. Java is an object oriented language whereas javascript is object based scripting language.




0 comments: