Hey friends,
Welcome to simplyjaavapro, today I will discuss about your first java program.
Yes, you guessed it right ! It is the most famous problems of all times..to print a message called Hello, World on the screen.
If this sounds to be boring, you can print whatever you may feel like.
The code goes like this:
class MyFirstJaavaProgram
{
public static void main(String args[])
{
System.out.println("Hello, World "); // You can type your message within the quotes
}
}
-------------------------------------------------------------------------------------------------------------------
Yes, this is it. Now save the file as MyFirstJaavaProgram.java
Next you need to open up your terminal window (or a command prompt), and give the following command:
javac MyFirstJaavaProgram.java
java MyFirstJaavaProgram
----------------------------------------------------------------------------------------------------------------
And there you go, your first java program has been created, compiled and executed.
No comments:
Post a Comment