Learning the basics
Everyday is a learning process. The more i learn a skill the more I get improved and acheive my short term goal which is to get a job as a fresher in the information technology industry.
So I started my learning process by learning some very basics stuffs which is the concept of "Hello World".
public Class main{
public static void main(String[]args){
System.out.println("Hello World!");
}
}
From the above code we get the result as:
output
Hello world !
The other basic feature that i learnt is that
- Java is Case Sensitive
- "MyClass" and "myclass" has different meaning
- Every program must have an main() method.
System.out.println
Inside every main() method we can use the println() method to print a line.
we can print how much ever println() method we want
Public class Main(){
public static void main(String[]args){
System.out.println("Hello World!");
System.out.println("I am learning Java");
System.out.println("It is new and fun");
}
}
Here for the above code the result will be
output
Hello World!
I am learning Java
It is new and fun
System.out.print
This function is similar to println() function
The only difference is that it does not print a new line.
System.out.print("Hello!");
System.out.print("My name is Ajay");
Here for the above code the result will be
output
Hello! My name is Ajay
Java output numbers
We use the println() methods to print the numbers
We do not need double Quotations to print the numbers.
System.out.println(30)
System.out.println(300)
System.out.println(3000)
For the above code the result will be
output
30
300
3000
Conclusion
Today was an important day because it takes a big steps towards my learning progress in java
Here are the things that I learnt today :
- How to print a simple Hello World Program
- mastering the basic of println() method
- mastering the print() method
- Learnt how to print output numbers using the println() methods
Top comments (0)