Check full java topics on this main page
What is a programming language?
Program - In simple terms, It is the language used by humans to interact with hardware(Computer). For more information on programming language, check this post programming language
Key components in Java programming
There are 3 key components in java
1. Java Development Kit(JDK)
2. Java Runtime Environment(JRE)
3. Java Virtual Machine(JVM)
These are discussed in detail in this article Java architecture
Key features of Java
Some key features are mentioned below
- Platform independent:- In Java after the source code gets compiled, it will get converted to byte code(.class file). In other languages, it will get compiled to platform-specific code.
- Object-Oriented:- As this is object-oriented, We can reuse the code rather than creating a new one, and code maintenance is easy. There are a lot of OOPS concepts we are going to cover in other posts
- Multithread:- Java can execute multiple tasks simultaneously.
- Better Performance:- As Java is using (JIT compiler - Just-In-Time) java code can run more efficiently. If the class is already compiled in the JIT compiler, it will not execute for the next time. So, Its performance is better than others.
Let us cover all the feature in Java in upcoming articles
Java editions
There are four Java editions,
- Standard Edition(Java SE)
- Enterprise Edition(Java EE)
- Micro Edition(Java ME)
- Java FX
{
// Instruction for the program(What needs to done)
}
Sample program
Program Definition
The program will execute from top to bottom starting from the main method.
- class: Instructs code to create a new class in this step
- class name: Class name should be a noun and it should start with a capital letter
- public static void main(String []args): This is the starting point of the program
- Public: If you are using java edition other than JavaFX, the main method should be public. When you try to execute without public type JVM will not able to find the main method
- static: This is the starting point of the program. This method should be called by the compiler before creating an object. As this main method is static, this can be called by the compiler before creating an object.
- void: For the main method JVM will not return any value. So, We are using void in the main method.
- main: Name configured in JVM, So we are using the main word
- String[] args: We can give the argument from the command prompt
- Order of modifier is not important - static public void main(String[] args)
- String[] args can be changed - main(String[] args),main(String []args),main(String args[])
- We can change array name in the main method - main(String[] x)
- We can mention array using var arg - (String... args)
- Can use a final modifier(We will cover this keyword in future)) - final public static void main(String[] args)
- Can use a synchronized modifier(We will cover this keyword in future)) - synchronized public static void main(String[] args)
- Can use strictfp modifier(We will cover this keyword in future)) - strictfp public static void main(String[] args)
- Can use many modifiers in the main method - final static synchronized strictfp public void main(String[] args)
- System.out.println: The System is a class present under java.lang. Under this class, there is a static variable of type PrintStream called out. println is a method present in PrintStream class.
Note: We will go through the full course and summarize it's advantages and disadvantages
Next Java Identifiers
Comments
Post a Comment