Over view of java:
- Java was invented by James Gosling at Sun Microsystems, Inc in 1991.
- It took 18 months to develop the 1st versions of java.
- This language is initially called “Oak” but was renamed “Java” in 1995.
- Java has become the most important programming language because it is a language for the internet.
Features
in Java:
- It is a very simple programming language.
- Java is a popular language because it is Object Oriented Programming language like C++.
- Platform independence (It
can be executed on a variety of systems so write once, run anywhere, and at any
time, forever).
- Java supports multithreading programming which allows a programmer to write such a program that can perform many tasks simultaneously.
- Java is designed for distributed systems. Hence two different objects on a different computer can communicate with each other. This can be achieved by remote Method Invocation (RMI). This feature is very much useful in client-server communication.
Types of
Java:
- JAVA2SE - Standard Edition - This provides basics and for the desktop application.
- JAVA2EE - Enterprise Edition -This is for web application development.
- JAVA2ME - Micro Edition -This is to develop the application for mobile, tablet.ect.
Java Programs
Java programs fall into two categories:
1.
Applications
2.
Applets
Applications:
An application in java is a program that you can execute
from any operating system prompt.
Stand-alone applications can either be,
1.
Window-based applications
2.
Console based applications
Applets:
Applets are programs that execute inside a web page.
Applications
of java:
- Desktop GUI Applications
- Mobile Applications
- Scientific Applications
- Web-based Applications
- Big Data Technologies
- Distributed Applications
- Cloud-based Applications
- Web servers
- Software Tools
- Gaming Applications
Working in an environment of java:
Download net beans with JDK, click the below link to
download.
https://www.oracle.com/technetwork/java/javase/downloads/jdk-netbeans-jsp-3413139-esa.html
Basic
structure of Java:
Syntax of java:
Example
program:
Output:
Program Explanation:
// Write a program to add two numbers... – This is a command-line for human understanding and not be executed in output.
Package
– It is used to hold a number of classes.
Import – It is used to
calling the external packages.
java.util.Scanner
– This package is used to calling the scanner function(To get values from the user).
public class Exampleprogram:
class definition part
- public – it is access specifiers and it can be used anywhere.
- Class – it is a keyword.
- Exampleprogram – class name
- Class is used to bind the variables and methods.
public static void main(String[] args): Mani
method
- public - it is access specifiers from anywhere we can access it.
- static - it is an access modifier we can call the methods directly by class name without creating its objects.
- void - it is the return type of your output.
- main() - it is a standard method name and used to indicate starting your program here to the compiler.
- String [] args - in java accept only the string type of argument and store it.
Scanner
– It is used to get value from users.
input – It is an
object name for scanner and this is a user-defined name.
int a,b
– variable declaration part
- int – it is a data type i.e. declaring kinds of your data format.
- a,b - variable i.e. used to hold the values.
System.out.println
– Print function.
- It is used to display any sentence on the user's system.
nextInt()
– It is a method for integer data types and gets values from users.
Execution
process of java:
Backend process of java when executing the program:
Step 1:
Source code – your program
Step 2:
Code editor
- It is used to edit the programs.
Step 3:
Compiler
- It is used to check errors.
- If your program has an error then go to step 2 to solve an error.
Step 4:
Byte code convertor
- If no error in your program then it’s converted to byte code that means machine code (0’s and 1’s).
Step 5:
JVM (Java Virtual Machine)
- JVM is nothing but, it is your platform like a laptop, phone, computer, etc.
- It is used to execute the byte codes.
Step 6:
JIT (Just In Time compiler)
- It is used to convert byte code into running machine code i.e. English language.
Step 7:
Output
- The final result is displaying in your systems.
Note:
If you need to learn about what is a programming language?
then click the below link to learn.
https://www.whereisstuff.com/2020/09/introductions-of-programming-language.html
No comments:
Post a Comment