JAVA LANGUAGE

What is Java language?

Java is a programming language and platform-independent language first released by Sun Microsystems in 1995. The name Java originates from a sort of espresso bean, Java. Gosling came up with this name while having a coffee near his office.

Feature of Java :-

Applications:-

  1. Desktop Applications such as acrobat reader, media player, antivirus.
  2. Web Applications such as irctc.co.in, javatpoint.com,
  3. Enterprise Applications such as banking applications.
  4. Mobile
  5. Embedded System
  6. Smart Card
  7. Robotics
  8. Games

Difference betweeen C++ and JAVA

Data types of Java:-

In java has 8 primitive data types :

  • Byte
  • short
  • int
  • long
  • double
  • float
  • boolean
  • char

Basics of Java:-

  • Object − Objects have states and behaviors. Example: A woman has states – color, name, height as well as behavior such as mood their sad, crying, eating. An object is an instance of a class.
  • Class − A class can be defined as a blueprint that describes the state that the object of its type supports.
  • Methods − A method is basically a behavior. A class can contain many methods. It is in methods where the logics are written, data is manipulated and all the actions are executed.
  • Instance Variables − Each object has its unique set of instance variables.
Why java is platform independent language?

Java language is developed in such a way that it does not depend on any hardware and software. Due to the fact compiler compiles the code and then converts it into platform-independent byte code which can be run in multiple systems. The only condition is that JRE installs on it.

What is  JDK,JRE and JVM?

JDK:- Java development kit.

It is a tool necessary to compile, document, and package Java programs. The JDK completely includes JRE.

JRE:- Java runtime environment.

It’s a runtime environment that implements JVM and provides all classes, libraries, and other files that uses at runtime.

JVM:-Java virtual machine.

It is an abstract machine.it provides a runtime environment in which java byte code can be executed.

Example:

public class MyFirstJavaProgram {

   /* This is my first java program.
    * This will print 'Hello World' as the output
    */

   public static void main(String []args) {
      System.out.println("Hello World"); // prints Hello World
   }
}

Output

C:\> javac MyFirstJavaProgram.java
C:\> java MyFirstJavaProgram 
Hello World
We will be happy to hear your thoughts

Leave a reply

Edusera
Logo
Open chat
1
Scan the code
Hello!👋
Can we help you?