Day 3: Writing My First Java Code

My name is Enaburekhan Praise, a dedicated and ambitious Computer Engineering student in my third year at Caritas University, Enugu, Amorji-Nike, Nigeria. Hailing from Edo State, I have honed my skills in HTML and CSS, which form the backbone of my web development projects.
I am known for my hardworking nature and reliability, consistently delivering on commitments both academically and personally. As a proficient computer literate, I possess extensive knowledge of MS applications, enabling me to handle various computing tasks with ease. My expertise in website development is complemented by a keen eye for detail and a passion for creating user-friendly digital experiences.
In addition to my technical skills, I am a strong problem solver and an effective communicator, always eager to learn and adapt in the ever-evolving field of technology. My commitment to continuous improvement and my ability to work well both independently and as part of a team make me a valuable asset in any setting.
After setting up our IDE, it is time to write our first java code. I can't express how excited I am.
Alright, let's get into it.
In Java, every application begins with a class name, and that class must match the filename.
Let's create our first Java file, called First.java, which can be done in any text editor .
The file should contain a "My First Java Code" message, which is written with the following code:
public class First {
public static void main(String[] args) {
System.out.println("My First Java Code");
}
}
Don't worry, I know it looks too complex now, it was like that for me too, but as we go on it will become clearer.
To explain code above, every line of code that runs in Java must be inside a "class". In our example, we named the class First. A class should always start with an uppercase first letter.
The name of the java file must match the class name. When saving the file, save it using the class name and add ".java" to the end of the filename.
As for the main() method, it is required in every java program. We'll not worry too much about the keywords before and after main. We will get to know them bit as we go on. For now, just remember that every Java program has a class name which must match the filename, and that every program must contain the main() method.
Inside the main() method, we can use the println() method to print a line of text to the screen.
The curly braces {} marks the beginning and the end of a block of code.
System is a built-in Java class that contains useful members, such as out, which is short for "output". The println() method, short for "print line", is used to print a value to the screen (or a file).
Don't worry too much about System, out and println(). Just know that you need them together to print stuff to the screen.
You should also note that each code statement must end with a semicolon (;).
Note: Java is case-sensitive: "MyClass" and "myclass" has different meaning, so we should be mindful of uppercase and lowercase letters, to not make any form of mistake.
Doesn't seem so complex now right?, This is the first out of many codes we'll write.



