How to run your first java program?
Well you are the person who is waiting to understand how do you print the text "I want to become Manual to Automation tester." using Java program.
Follow the steps:
1. open your Notepad++, i have told you to install in my last posting.
2. Now save the file name say 'ManualToAutomation.java' where .java extension file format in Java.
3. Enter the below code.
class ManualToAutomation{ // Note: File name and class name should be same
public static void main(String[] args){ // main Function.
System.out.println("I want to become Manual to Automation tester.");
}
4. Now navigate to the folder path where the "ManualToAutomation.java" file is saved.
5. Now enter the command in DOS command prompt
javac ManualToAutomation.java
and press ENTER button.
Note: javac - is a java compiler.
6. Observe the "ManualToAutomation.class" file is created which is a byte code file. which is created by our program after compiling.
7. Now to run the below command to work our program
java ManualToAutomation
and press ENTER button, Note that I have not added any file extension.
8. Observe the DOS command prompt screen will print the line "I want to become Manual to Automation tester." which is entered in the program file.
Remember these:
1. Main function should be there to run the program, otherwise program throws "Exception in thread "main" java.lang.NoSuchMethodError: main". You can compile the program without main function.
2. 'S' Should be uppercase in System.out.println("")
3. File name and class name should be same and save the file extension in .java , for good practice.
Well you are the person who is waiting to understand how do you print the text "I want to become Manual to Automation tester." using Java program.
Follow the steps:
1. open your Notepad++, i have told you to install in my last posting.
2. Now save the file name say 'ManualToAutomation.java' where .java extension file format in Java.
3. Enter the below code.
class ManualToAutomation{ // Note: File name and class name should be same
public static void main(String[] args){ // main Function.
System.out.println("I want to become Manual to Automation tester.");
}
4. Now navigate to the folder path where the "ManualToAutomation.java" file is saved.
5. Now enter the command in DOS command prompt
javac ManualToAutomation.java
and press ENTER button.
Note: javac - is a java compiler.
6. Observe the "ManualToAutomation.class" file is created which is a byte code file. which is created by our program after compiling.
7. Now to run the below command to work our program
java ManualToAutomation
and press ENTER button, Note that I have not added any file extension.
8. Observe the DOS command prompt screen will print the line "I want to become Manual to Automation tester." which is entered in the program file.
Remember these:
1. Main function should be there to run the program, otherwise program throws "Exception in thread "main" java.lang.NoSuchMethodError: main". You can compile the program without main function.
2. 'S' Should be uppercase in System.out.println("")
3. File name and class name should be same and save the file extension in .java , for good practice.