Site icon TestingDocs.com

Can we code a Java program using Notepad editor?

Answer:

Yes, we can code a Java program using a text editor like Notepad editor. The prerequisite of running the program is proper JDK installation and setting of environment variables like PATH etc.

Basically, this is how we write a simple java program without the help of any IDE like ( Eclipse, IntelliJ, etc) to learn java programming steps.

Open Notepad

Open Run prompt.

Type Notepad.exe to launch the Notepad editor.

Code the Java Program

Write a simple Java program in the Notepad editor.

/*----------------------------
 * Sample Program -
 *  in Notepad Editor 
 *  www.TestingDocs.com
 */
public class SampleDemo {
public static void main(String[] args) {
  System.out.println("This program is written in Notepad editor.");
  }
}

 

Save the program

Save the program with the same name as the class name on to your hard disk. i.e SampleDemo.java

Compile the program

Launch command prompt.

Change directory to the Java file.

Issue the javac command.

/> javac SampleDemo.java

Run the Program

Issue the java command.

/> java SampleDemo

 

 

Exit mobile version