First Java Program - Input/Output Part-1

Introduction
Java is a versatile, object-oriented programming language known for its platform independence. Java is widely used in web development, mobile app development, desktop applications , and enterprise software. It's also available in open-source implementations like OpenJDK.
In this bloggs we cover alots of things , we look into how to code in java, what is classes, comments and how to code in intellij idea or more
Creating .java file
In java one things that I mention that every things you gone writing in Java. It's gone be a classes. every files with the extension of .java it's a class itself.
.java file involves writing Java code, saving it with a .java extension, and compiling it using javac . Then, you can run the Java program with the java command.
firstprogram.java
Creating Main Function:
The main function basically Means where the program will start. In Java, if there is no main function you will not be able to run the program.
public static void Main(string[] args){
}
// this is main function in java
Writing first code (print "hello world");
public class Main{
public static void main(string[] args){
System.out.println("Hello World!");
}
}
Converting .java to .class(Byte Code)
one's you install JDK you will get javac
~javac Main.java
~java Main
// output: Hello World!
How to change the location of the byte code?
you can change the location where the bytecode (.class files) is generated during compilation by specifying the output directory using the -d option with the javac command.
~javac -d /path/to/output/directory YourJavaFile.java
-d flags => this is basically asking for a particular location where you want to store the bytecode(.class file)
Starting with Intellij's idea

Download and Install IntelliJ IDEA:
Visit the official JetBrains website to download IntelliJ IDEA: https://www.jetbrains.com/idea/download/
Run the installer and follow the on-screen instructions to install IntelliJ IDEA.
Launch IntelliJ IDEA:
- After installation, launch IntelliJ IDEA.
Configure IntelliJ IDEA:
When you first start IntelliJ IDEA, you'll be prompted to configure the IDE settings. You can choose the default settings or customize them based on
Following steps :
Click project
Select the latest version
Open JDK
Click Project from the Template
Create a file
Finish.......
package com.jibachh public class Main{ public static void main{Strings[] agrs){ // write your code here } }
some Shortcut of Intellij idea:
| Action | Shortcut |
| Search everywhere | Double + Shift |
| Go to file | Ctrl + Shift + N |
| Go to class | Ctrl + N |
| Go to symbol | Ctrl + Alt + Shift + N |
| Go to declaration | Ctrl + B |
FQA:
what is package?
\=> A package is a way to organize and group related classes and interfaces.
what is system.out.println()?
\=>
System.out.println()is a Java statement that is used to print text or output to the console.what is output in java?
\=> A Printstream adds functionality to another output stream , namely the ability to print representation of various data values, conveniently.
what is input in java?
\=> "input" refers to the process of obtaining data or information from external sources, typically from the user, a file, a network connection, or another program
what is class in java?
\=>class in name group of Propertices and function.
what is static in java?
\=>
staticis used to create variables and methods that belong to the class itself.what is public in java?
\=> Public means that this class is access from everywhere.
what is Main function in java?
\=> the Main function is entry of the java program
what is void in java?
\=>
voidis a keyword used in method declarations to indicate that the method does not return a value.what is main class in java?
\=> Main class in java is just a name of the file name.





