What is Java?
Java is a high-level, class-based, object-oriented programming language that was made by James Gosling in 1995 It is a general-purpose programming language that was designed to Write once and compile And run it on different platforms It was based on the WORA principle, which refers to "Write once, Run anywhere" Java creators wished that people never had to compile the code a multiple times They just have to compile the code once and then they can easily run it on different platforms So that people don't face any problems. History Because it was made by James Gosling for Sun Microsystems, He was also known as "The Father of Java" There was an Oak Tree just outside the office of James Gosling That's why he named this language "Oak" But later it was named "GreenTalk" Later on it was named "Java", after the Indonesian Coffee which was liked by many people Sun Microsystem approached ECBA and ISO And asked them to make a standard for JAVA But Sun microsystem themselves rejected this idea And Java's standard was not found.
JAVA was the proprietary language of Sun Microsystem Developers were still able to write
JAVA
Java codes for free Then how was Sun Microsystem able to earn money?
Sun Microsystem was able to earn money by selling the Java Enterprise product. When Java was developing, C and C++ were the most popular programming languages.
Gosling wanted Java to be a very easy and productive language even for the developers, who were already coding in C and C++. That's why the Java syntax was kept very close to the syntax of C and C++.
Java was originally made for the Digital Cable Industry, it was made for the TV but finally, this idea was also rejected because Java was a very advanced language for Digital Cable Industry at that time. Java was primarily made by keeping five goals in mind, which are present on your computer screen. Java became popular with time, Java received a lot of love from users, And android apps were also being made using Java which increased its popularity. And finally, in today's date, Java is still a very popular programming language. Java's further development timeline is present on your computer screen So this was about the development and history of Java, now let’s move towards the syntax and learn how to write a Java code Hello World Program "Hello World Program" can be written in Java in this way, here public is an access modifier which means this function can be accessed by anyone "Static" means it is not necessary to make the object of this class to run this method "Void" means this method does not return anything And "main" means the main method, which means the execution of this particular program starts from here, String args, which are visible here, is used for command line argument How Java code is compiled?
The source code of Java is first compiled into bytecode using the JAVAC compiler once this compiler generates the Bytecode, then the Bytecode can be carried in any computer or any mobile phone, it is a platform independent Bytecode that runs similarly across devices this Bytecode is executed by Java Virtual Machine depending on the platform Comments Comments are the texts which are ignored by Java Single line comments in Java are written in this way
And Multi-Line Comments in Java are written in this way Java is Statically Typed, which means you have to specify the type of variable which you want to make Java has eight different Data Types which are present on your screen Operators in Java can be written in this way Operators in Java User Input in Java can be accepted in this way You can print anything in Java using "System.out.println" in this way Strings You can make Strings in Java somehow in this way There are some amazing methods which are used to manipulate the Strings in Java
Some of the important methods of Strings are present on your screen Conditional statements To write the Conditions in Java, you can use "If-Else Statement", "If" denotes a boolean or a condition that is evaluated in Boolean, if this condition is true, the code inside the "If" is executed, and if it is false, then the code inside "Else" is executed
you can also create an "If-Else" ladder in this way a very similar thing to "If-Else" is the "Switch Case Statement" which executes some block of code based on a Variable.
Syntax of "Switch Case Statement" is present on your screen Iterative Statements
Mainly three types of Loops are used in Java
1. While Loop;
2. Do-While Loop;
3. For Loop;
4. For Each Loop;
The "For Loop" syntax in Java is used in this way, "For Each Loop" syntax in Java is used in this way, the "While Loop" syntax in Java is used in this way, And "Do While Loop" syntax in Java is used in this way Arrays In Java you can use Arrays to store more than one Variables You can use the Syntax and some of the methods of Arrays in this way When any type of loop is running and it encounters a break statement, it will stop there Somewhat like this And if you write "continue" inside the loop, as soon as "continue" encounters, the current iteration of the loop is skipped
OOPS Java is an object-oriented programming language and it includes the concepts of class and objects. Any type of code that you write in Java, is written under a class "Method" is a function that is written under a class, and you can invoke a method using objects.
In Java, Constructors can be written in this way You can make a "child class" of a particular "class" This means that it will inherit all the properties of the Parent Class into the Child Class and the methods will also be inherited According to some rules, the inheritance code of Java is present on your screen You can override the Methods in Java,
This means if you want to change a Method in the Child Class, that was present in the Parent Class. Then you can use the Method Overriding in this way Abstraction in Java Java programming includes the concept of "Abstraction" Abstraction means you can hide the implementation details In Java,
Abstract Method is the method where there is no implementation And Abstract Class is the Class that can have Abstract Methods as well as a few Non-Abstract Methods
There is a concept of "Interfaces" in Java programming Interfaces in Java According to this you can assign specifications to a Class Like what should the class implement and what methods will it implement This is a method of achieving Abstraction in Java programming So this was the Syntax of Java programming,
Final Note
I hope you have quickly learned and understood a lot about Java Programming
And I hope you can learn a lot about Java Programming from that course
0 Comments