Hello : How to Create Your First Java Program
It's a First Program Of Java⬇
class Suryansh
{
public static void main(String a[])
{
System.out.println("hello");
}
}
format of save the java program & Important points
format: classname.java
{ first letter of class name is always capital }
{class name and file name is always same }
ex: Suryansh.java,Technical.java
Compile the Program |
we will use the javac command[CMD] to convert your Java program into a form more amenable for execution on a computer.
- first open CMDC:\Users\username>d: {drive name}D:\>cd java {folder name when program is saved}
- Assuming the file, say Suryansh.java, is in the current working directory, type the javac command give space and your program name.
D:\java>javac Suryansh.java
- write our java & our program name with out ".java"
If everything went well, you should see no error messages.
Execute the Program |
You will use the java command to execute your program.
- From the Command Prompt, type the java command below.
D:\java>java Suryansh
Hello
No comments:
Post a Comment